How To Install and Configure Elasticsearch on Rocky Linux 8

How to Install and Configure Elasticsearch on Rocky Linux 8

How To Install and Configure Elasticsearch on Rocky Linux 8

With the aid of the potent open-source Elasticsearch search and analytics engine, users can store, search for, and perform near real-time analysis on massive amounts of data. It frequently serves as the search engine for corporate information, log analysis, and web applications. You can follow the instructions in this guide to install and set up Elasticsearch on Rocky Linux 8.

Step 1: Update your system

To install Elasticsearch on Rocky Linux 8, you must first make sure your system is up to date. Run the following command in your terminal to accomplish this:

sudo dnf update -y

This will update all the packages on your system to their latest versions.

How To Install and Configure Elasticsearch on Rocky Linux 8

Step 2: Install Java

Java needs to be installed on your machine in order to use Elasticsearch. The following command can be used to install Java if it isn’t already installed on your computer:

sudo dnf install java-11-openjdk-devel

This will install the OpenJDK 11 development kit, which is compatible with Elasticsearch.

Step 3: Download Elasticsearch

Elasticsearch must then be downloaded from the official website. With the following command, you may get the most recent version of Elasticsearch:


This will download the Linux x86 64 architecture version of Elasticsearch 7.16.3. On the official Elasticsearch website, you can look up the most recent version and update the aforementioned command accordingly.

Step 4: Extract Elasticsearch

After downloading Elasticsearch, extract it using the following command:

tar -xzf elasticsearch-7.16.3-linux-x86_64.tar.gz

This will extract Elasticsearch to a new directory called elasticsearch-7.16.3.

Step 5: Configure Elasticsearch

Elasticsearch must now be configured before it can be used after being extracted. To achieve this, open the elasticsearch.yml file in your preferred text editor by navigating to the elasticsearch-7.16.3 directory:

cd elasticsearch-7.16.3
sudo vi config/elasticsearch.yml

In the elasticsearch.yml file, you need to configure the following settings:

  • The name of your Elasticsearch cluster.
  • The name of the Elasticsearch node.
  • The path to the directory where Elasticsearch will store its data.
  • path.logs: The path to the directory where Elasticsearch will store its logs.

Here’s an example configuration: my-elasticsearch-cluster my-elasticsearch-node /var/lib/elasticsearch
path.logs: /var/log/elasticsearch

Save and close the file after making the necessary changes.

Step 6: Start Elasticsearch

You’re now ready to start Elasticsearch. You can start Elasticsearch using the following command:


This will start Elasticsearch in the foreground. If you want to start Elasticsearch in the background, you can use the following command:

./bin/elasticsearch -d

This will start Elasticsearch in daemon mode.

Step 7: Test Elasticsearch

You can use the curl command to submit an HTTP request to the Elasticsearch server in order to verify that Elasticsearch is functioning properly. Run the following command in a fresh terminal window:

curl http://localhost:9200

A JSON response containing details about the Elasticsearch server, such as the version and cluster name, should appear if Elasticsearch is functioning properly.

Step 8: Configure Elasticsearch to Start Automatically

You can build an Elasticsearch systemd service if you want Elasticsearch to launch automatically when your system starts up. In the /etc/systemd/system directory, add a new file called elasticsearch.service to accomplish this:

sudo vi /etc/systemd/system/elasticsearch.service

Paste the following code into the file:




Save and close the file after making the necessary changes. Then, reload the systemd configuration and start Elasticsearch:

sudo systemctl daemon-reload
sudo systemctl start elasticsearch

Elasticsearch will now start automatically whenever your system boots up.


You should now have Elasticsearch installed and set up on your Rocky Linux 8 machine if you followed the instructions in this article. Elasticsearch is a potent technology that may be applied to a variety of tasks, such as search and analytics. With the help of this lesson, you can quickly begin using Elasticsearch to search and analyze your data.

Additional Tips

Here are some more pointers to make the most of Elasticsearch:

  • To ensure that Elasticsearch has adequate memory to operate effectively, it is crucial to optimize the JVM heap size during configuration. The -Xms and -Xmx options in the jvm.options file in the Elasticsearch config directory can be changed to achieve this.
  • Elasticsearch has a robust REST API that may be used for a variety of operations, such as indexing and querying data, maintaining indices and nodes, and customizing settings. Reading the Elasticsearch documentation will provide you with more information about the Elasticsearch REST API.
  • In addition, Elasticsearch has a variety of plugins that can be used to expand its capability. These include the Beats plugin for gathering data from various sources, the Logstash plugin for ingesting and processing data, and the Kibana plugin for viewing and studying data.

Final Thoughts

With Rocky Linux 8, installing and configuring Elasticsearch is a simple operation that can be completed with a few short keystrokes. You can quickly set up Elasticsearch on your system and start using its robust search and analytics features to obtain insights into your data by following the instructions in this guide.

It’s important to always keep Elasticsearch up to date with the most recent security patches and to adhere to recommended security installation procedures. You may use Elasticsearch to run a variety of applications and acquire insightful data using these safety measures.


Scroll to Top