Elasticsearch is a free, open-source, distributed search and analytics engine capable of handling a large amounts of data. It is used for real-time full-text searches in applications where a large amount of data needs to be analyzed. It is very popular due to its usability, powerful features, and scalability. It supports RESTful with an HTTP URI to manipulate data. Elasticsearch is easy to use, offering features such as automatic node recovery, improved security, scalability and resiliency, automatic data balancing, and more.

In this post, we will show you how to install and configure Elasticsearch on Rocky Linux 10.

Step 1 – Install Java

Elasticsearch is a Java-based application, so Java must be installed on your server. If not installed, you can install it by running the following command:

dnf install java-21-openjdk-devel -y

After the installation, verify the Java version using the following command:

java --version

Sample output:

openjdk 21.0.8 2025-07-15 LTS
OpenJDK Runtime Environment (Red_Hat-21.0.8.0.9-1) (build 21.0.8+9-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-21.0.8.0.9-1) (build 21.0.8+9-LTS, mixed mode, sharing)

Step 2 – Create Elasticsearch Repository

By default, Elasticsearch is not included in the Rocky Linux default repository, so you will need to create a repository for it.

First, download and import the GPG key with the following command:

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

Next, create an Elasticsearch repo with the following command:

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

Add the following lines:

[elasticsearch]
name=Elasticsearch repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

Save and close the file when you are finished.

Step 3 – Install and Configure Elasticsearch

Now, install the Elasticsearch package with the following command:

dnf install elasticsearch -y

After installing Elasticsearch, edit the Elasticsearch main configuration file:

nano /etc/elasticsearch/elasticsearch.yml

Change the following lines:

cluster.name: my-cluster
node.name: node-1

# Data paths
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch

# Bind locally for testing
network.host: 127.0.0.1
http.port: 9200

# Optional for quick testing (disables HTTPS/auth)
xpack.security.enabled: false

Save and close the file, then start the Elasticsearch service and enable it to start at system reboot:

systemctl start elasticsearch
systemctl enable elasticsearch

Now, check the status of the Elasticsearch with the following command:

systemctl status elasticsearch

You should get the following output:

ā— elasticsearch.service - Elasticsearch
     Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; preset: disabled)
     Active: active (running) since Tue 2025-10-21 04:49:30 EDT; 33s ago
 Invocation: 0be86d5fa6094c57afcd326ff343cd5a
       Docs: https://www.elastic.co
   Main PID: 9012 (java)
      Tasks: 80 (limit: 24809)
     Memory: 2.3G (peak: 2.3G)
        CPU: 46.807s
     CGroup: /system.slice/elasticsearch.service
             ā”œā”€9012 /usr/share/elasticsearch/jdk/bin/java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=/usr/share/elasticsearch/bin/elasticsearch -Dcli.libs=lib/tool>
             ā”œā”€9072 /usr/share/elasticsearch/jdk/bin/java -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=tru>

You can now verify Elasticsearch using the following command:

curl -X GET 'http://localhost:9200'

If everything is fine, you should get the following output:

{
  "name" : "node-1",
  "cluster_name" : "my-application",
  "cluster_uuid" : "_na_",
  "version" : {
    "number" : "8.19.5",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "d6dd0417f05cd69706f4f103c69bbb8b7688db9c",
    "build_date" : "2025-10-03T16:35:50.165700789Z",
    "build_snapshot" : false,
    "lucene_version" : "9.12.2",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

Step 4 – How to Use Elasticsearch

After installing Elasticsearch, we will add some data and use manual queries to test Elasticsearch’s functionality.

Add some content to the Elastisearch using the Curl command:

curl -H 'Content-Type: application/json' -X POST 'http://localhost:9200/tutorial/helloworld/1' -d '{ "message": "Hello World!" }'

Sample output:

{"_index":"tutorial","_type":"helloworld","_id":"1","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1}

Now, run the following command the retrieve the added entry:

curl -X GET 'http://localhost:9200/tutorial/helloworld/1'

Sample output:

{"_index":"tutorial","_type":"helloworld","_id":"1","_version":1,"_seq_no":0,"_primary_term":1,"found":true,"_source":{ "message": "Hello World!" }}

If you want to modify the existing entry, run the following command:

curl -H 'Content-Type: application/json' -X PUT 'localhost:9200/tutorial/helloworld/1?pretty' -d ' {
  "message": "Welcome Back!"
}'

Sample output:

{
  "_index" : "tutorial",
  "_type" : "helloworld",
  "_id" : "1",
  "_version" : 2,
  "result" : "updated",
  "_shards" : {
    "total" : 2,
    "successful" : 1,
    "failed" : 0
  },
  "_seq_no" : 1,
  "_primary_term" : 1
}

Now, retrieve the modified data and display it in a human-readable format using the following command:

curl -X GET 'http://localhost:9200/tutorial/helloworld/1?pretty'

Sample output:

{
  "_index" : "tutorial",
  "_type" : "helloworld",
  "_id" : "1",
  "_version" : 2,
  "_seq_no" : 1,
  "_primary_term" : 1,
  "found" : true,
  "_source" : {
    "message" : "Welcome Back!"
  }
}

Conclusion

In the above guide, you learned how to install and use Elasticsearch on Rocky Linux 10. You can now use Elasticsearch with other tools, such as Kibana and Logstash to search and display data via a graphical interface. Start using Elasticsearch on dedicated hosting from Atlantic.Net.