Wednesday, September 3, 2025
HomeUncategorisedHow To Install Elasticsearch on RHEL 8 / CentOS 8

How To Install Elasticsearch on RHEL 8 / CentOS 8

How can I install Elasticsearch on RHEL 8 / CentOS 8 Linux system?. This guide will help you to install Elasticsearch on RHEL 8 / CentOS 8 Linux system. 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.

For multi-node cluster, refer to Setup Elasticsearch Cluster on CentOS | Ubuntu With Ansible

Step 1: Install Java on RHEL 8 / CentOS 8

As Elasticsearch depends on Java, you need it installed on your system prior to installing Elasticsearch 6 or 5 on RHEL 8.

Confirm Java works by checking the version.

$ java -version
openjdk version "11.0.14" 2022-01-18 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.14+9-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.14+9-LTS, mixed mode, sharing)

$ which java
/usr/bin/java

Step 2: Add Elasticsearch YUM Repository

For Elasticsearch 7.x, add:

cat <<EOF | sudo tee /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/oss-7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF

For Elasticsearch 6.x, add:

cat <<EOF | sudo tee /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-6.x]
name=Elasticsearch repository for 6.x packages
baseurl=https://artifacts.elastic.co/packages/oss-6.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF

For Elasticsearch 5.x, add:

cat <<EOF | sudo tee /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-5.x]
name=Elasticsearch repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/oss-5.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF

Once the repository is added, clear and update your YUM package index.

sudo yum clean all
sudo yum makecache

Step 3: Install Elasticsearch on RHEL 8 / CentOS 8

Elasticsearch repository is ready for use on the system. You can install Elasticsearch using the command below:

sudo yum -y install elasticsearch-oss

Confirm package installation.

$ rpm -qi elasticsearch-oss 
Name        : elasticsearch-oss
Epoch       : 0
Version     : 7.10.2
Release     : 1
Architecture: x86_64
Install Date: Tue 18 Oct 2022 07:36:01 PM UTC
Group       : Application/Internet
Size        : 420252496
License     : ASL 2.0
Signature   : RSA/SHA512, Wed 13 Jan 2021 03:45:21 AM UTC, Key ID d27d666cd88e42b4
Source RPM  : elasticsearch-oss-7.10.2-1-src.rpm
Build Date  : Wed 13 Jan 2021 12:54:36 AM UTC
Build Host  : packer-virtualbox-iso-1600176624
Relocations : /usr
Packager    : Elasticsearch
Vendor      : Elasticsearch
URL         : https://www.elastic.co/
....

You can set JVM options like memory limits by editing the file: /etc/elasticsearch/jvm.options

sudo vim /etc/elasticsearch/jvm.options

Example below sets initial/maximum size of total heap space

-Xms1g
-Xmx1g

If your system has less memory, you can configure it to use small megabytes of ram.

-Xms256m
-Xmx512m

Start and enable elasticsearch service on boot:

$ sudo systemctl enable --now elasticsearch.service 
 Synchronizing state of elasticsearch.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
 Executing: /usr/lib/systemd/systemd-sysv-install enable elasticsearch
 Created symlink /etc/systemd/system/multi-user.target.wants/elasticsearch.service → /usr/lib/systemd/system/elasticsearch.service.

Test to verify that it is working:

$ curl http://127.0.0.1:9200 
{
  "name" : "cent7.mylab.io",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "p2FuivSdRMqobd3zA5RR8Q",
  "version" : {
    "number" : "7.10.2",
    "build_flavor" : "oss",
    "build_type" : "rpm",
    "build_hash" : "747e1cc71def077253878a59143c1f785afa92b9",
    "build_date" : "2021-01-13T00:42:12.435326Z",
    "build_snapshot" : false,
    "lucene_version" : "8.7.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

Create a test index:

$ curl -X PUT "http://127.0.0.1:9200/mytest_index"
{"acknowledged":true,"shards_acknowledged":true,"index":"mytest_index"}

Step 4: Install Kibana on RHEL / CentOS 8

If you need to install Kibana visualization tool, run the command below in your terminal.

sudo yum -y install kibana-oss

After a successful installation, configure Kibana:

$ sudo vim /etc/kibana/kibana.yml
 server.host: "0.0.0.0"
 server.name: "kibana.example.com"
 elasticsearch.url: "http://localhost:9200"

Change other settings as desired then start kibana service:

sudo systemctl enable --now kibana

Access http://ip-address:5601 to open Kibana Dashboard:

elasticsearch kibana centos7 min

If you have an active firewall, you’ll need to allow access to Kibana port:

sudo firewall-cmd --add-port=5601/tcp --permanent
sudo firewall-cmd --reload

You now have Elasticsearch 7/6/5 on RHEL / CentOS 8.

Elasticsearch Learning Video Courses

Also read:

How to delete Elasticsearch Index data with curl

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32260 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6625 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11854 POSTS0 COMMENTS
Shaida Kate Naidoo
6745 POSTS0 COMMENTS
Ted Musemwa
7022 POSTS0 COMMENTS
Thapelo Manthata
6694 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS