Introduction:
Elasticsearch is a powerful open-source search and analytics engine that allows you to store, search, and analyze large volumes of data quickly. It is commonly used for applications involving log analytics, full-text search, and real-time data analysis. In this article, we will walk you through the process of installing and configuring Elasticsearch on Rocky Linux 8.
Step 1: Update the System:
Before we begin, it’s essential to ensure that your Rocky Linux 8 system is up to date. Open a terminal and execute the following command:
sudo dnf update
Step 2: Install Java:
Elasticsearch requires Java to run. We will install OpenJDK, which is a free and open-source implementation of the Java Platform. Execute the following command to install it:
sudo dnf install java-11-openjdk-devel
Step 3: Download and Install Elasticsearch:
To download Elasticsearch, you can visit the official Elasticsearch website (https://www.elastic.co/downloads/elasticsearch) and copy the link to the latest version. In the terminal, use the wget
command to download the Elasticsearch package. For example:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.13.2-x86_64.rpm
Once the download is complete, install Elasticsearch using the dnf
package manager:
sudo dnf install elasticsearch-7.13.2-x86_64.rpm
Step 4: Configure Elasticsearch:
After installing Elasticsearch, we need to make some configuration changes. Open the Elasticsearch configuration file using a text editor:
sudo nano /etc/elasticsearch/elasticsearch.yml
Inside the file, find the line that starts with #network.host:
and remove the #
at the beginning. Set the value to localhost
if you want to access Elasticsearch only from the local machine. If you want to access it from other machines on the network, set the value to the IP address of your server. Save and close the file.
Step 5: Start and Enable Elasticsearch:
To start Elasticsearch, use the following command:
sudo systemctl start elasticsearch
To enable Elasticsearch to start automatically at system boot, run the following command:
sudo systemctl enable elasticsearch
Step 6: Verify Elasticsearch Installation:
To verify if Elasticsearch is running correctly, open your web browser and navigate to http://localhost:9200
. You should see a JSON response containing information about your Elasticsearch cluster.
Step 7: Elasticsearch Security (Optional):
By default, Elasticsearch is not secured. It is highly recommended to configure security features like authentication and encryption to protect your data. The Elasticsearch documentation provides detailed instructions on how to set up security features.
Conclusion:
Congratulations! You have successfully installed and configured Elasticsearch on Rocky Linux 8. You can now start utilizing Elasticsearch’s powerful search and analytics capabilities. Remember to secure your Elasticsearch installation to protect your data. The possibilities with Elasticsearch are vast, so dive into the documentation to explore its full potential. Happy searching!