How To Install Elasticsearch on RHEL 8 / CentOS 8

Posted on 229 views

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

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.

How to Install Java 11 (OpenJDK 11) on RHEL 8

How to Install Elasticsearch 7/6/5 on RHEL 8 / CentOS 8

For Elasticsearch 7.x, add:

cat <

To install Elasticsearch 6 on RHEL 8, add its repository to your system.

cat <

For Elasticsearch 5.x, add:

cat <

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

sudo yum clean all
sudo yum makecache

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

sudo yum -y install elasticsearch-oss

Confirm package installation.

$ rpm -qi elasticsearch-oss 
 Name        : elasticsearch
 Epoch       : 0
 Version     : 7.4.0
 Release     : 1
 Architecture: x86_64
 Install Date: Thu 17 Oct 2019 05:10:43 AM UTC
 Group       : Application/Internet
 Size        : 395896718
 License     : ASL 2.0
 Signature   : RSA/SHA512, Fri 27 Sep 2019 10:40:01 AM UTC, Key ID d27d666cd88e42b4
 Source RPM  : elasticsearch-oss-7.4.0-1-src.rpm
 Build Date  : Fri 27 Sep 2019 08:49:06 AM UTC
 Build Host  : packer-virtualbox-iso-1553723689
 Relocations : /usr 
 Packager    : Elasticsearch
 Vendor      : Elasticsearch
 URL         : https://www.elastic.co/
 Summary     : Elasticsearch is a distributed RESTful search engine built for the cloud. Reference documentation can be found at https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html and the 'Elasticsearch: The Definitive Guide' book can be found at https://www.elastic.co/guide/en/elasticsearch/guide/current/index.html
 Description :
 Elasticsearch subproject :distribution:packages

You can set JVM options like memory limits by editing the file: /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" : "bBzN5Kg",
   "cluster_name" : "elasticsearch",
   "cluster_uuid" : "LKyqXXSvRvCpX9QAwKlP2Q",
   "version" : 
     "number" : "6.5.4",
     "build_flavor" : "default",
     "build_type" : "rpm",
     "build_hash" : "d2ef93d",
     "build_date" : "2018-12-17T21:17:40.758843Z",
     "build_snapshot" : false,
     "lucene_version" : "7.5.0",
     "minimum_wire_compatibility_version" : "5.6.0",
     "minimum_index_compatibility_version" : "5.0.0"
   ,
   "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"

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-1024x372

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.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.