How to Install Elasticsearch on Rocky Linux 8

Elasticsearch is an Open source full-text search and analytics engine tool used to store, search, and analyze big volumes of data in near real time.

Installing Java

As Elasticsearch depends on Java and it has to be installed on system by using following command.

dnf install java-11-openjdk-devel

Verify the Java installation by following command.

java -version


[root@server ~]# java -version
openjdk version "11.0.11" 2021-04-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.11+9-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.11+9-LTS, mixed mode, sharing)
[root@server ~]#

Installing Elasticsearch

Run the following command to install GPG key for the Elasticsearch rpm packages.

rpm --import

Next, create a yum repository file for the Elasticsearch.

nano /etc/yum.repos.d/elasticsearch.repo

Add the following content.

name=Elasticsearch repository for 7.x packages

Save and exit,

After the repository is enabled, install the Elasticsearch package by using.

dnf install elasticsearch


[root@server ~]# dnf install elasticsearch
Elasticsearch repository for 7.x packages                                                                    24 MB/s |  25 MB     00:01
Last metadata expiration check: 0:00:13 ago on Thu 27 May 2021 05:23:44 PM EDT.
Dependencies resolved.
 Package                            Architecture                Version                        Repository                              Size
 elasticsearch                      x86_64                      7.13.0-1                       elasticsearch-7.x                      312 M

Transaction Summary
Install  1 Package

Total download size: 312 M
Installed size: 520 M
Is this ok [y/N]: y

Configure Elasticsearch

After installation is completed, edit Elasticsearch configuration file “/etc/elasticsearch/elasticsearch.yml” and set the to localhost.

vim /etc/elasticsearch/elasticsearch.yml

Add the following content, Crowncloud-Cluster node-1 /var/lib/elasticsearch

Save and exit,

Now enable and start the Elasticsearch service.

systemctl enable elasticsearch

systemctl start elasticsearch

Check the status of the service by using following command.

systemctl status elasticsearch


[root@server ~]# systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
     Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
     Active: active (running) since Thu 2021-05-27 17:26:14 EDT; 12min ago
 Main PID: 82908 (java)
        Tasks: 55 (limit: 11394)
     Memory: 1.1G
     CGroup: /system.slice/elasticsearch.service
                     ├─82908 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.t>
                     └─83105 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller

May 27 17:25:24 server systemd[1]: Starting Elasticsearch...
May 27 17:26:14 server systemd[1]: Started Elasticsearch.

Testing Elasticsearch

Run the following command to view the Elasticsearch server configuration and version details.

curl -X GET "localhost:9200/"


[root@server ~]# curl -X GET "localhost:9200/"
    "name" : "node-1",
    "cluster_name" : "Crowncloud-cluster",
    "cluster_uuid" : "G0GdHCQnRqe2ABCp9EMD3Q",
    "version" : {
        "number" : "7.13.0",
        "build_flavor" : "default",
        "build_type" : "rpm",
        "build_hash" : "5ca8591c6fcdb1260ce95b08a8e023559635c6f3",
        "build_date" : "2021-05-19T22:22:26.081971330Z",
        "build_snapshot" : false,
        "lucene_version" : "8.8.2",
        "minimum_wire_compatibility_version" : "6.8.0",
        "minimum_index_compatibility_version" : "6.0.0-beta1"
    "tagline" : "You Know, for Search"