Introduction:
Elasticsearch is an open-source search and analytics engine widely used for storing, searching, and analyzing large volumes of data. It is a popular choice for applications involving log analytics, full-text search, and real-time data analysis. In this article, we will walk you through the step-by-step process of installing and configuring Elasticsearch on Rocky Linux 9, the latest version of this enterprise-ready operating system.
Step 1: Update the System:
Before proceeding with the installation, it is essential to ensure that your Rocky Linux 9 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, the 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, 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.15.0-x86_64.rpm
Once the download is complete, install Elasticsearch using the dnf
package manager:
sudo dnf install elasticsearch-7.15.0-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
Within 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 intend 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 setting up security features.
Conclusion:
Congratulations! You have successfully installed and configured Elasticsearch on Rocky Linux 9. With Elasticsearch up and running, you can leverage its powerful search and analytics capabilities for your applications. Ensure you explore the documentation to maximize Elasticsearch’s potential, and consider implementing security measures to protect your valuable data. Start harnessing the power of Elasticsearch on Rocky Linux 9 today!