How to install ElasticSearch 7 on Almalinux 8/9, RockyLinux8/9 or RHEL 8/9

First of all, you should make sure you have no other ElasticSearch versions installed.

If you want to remove an old installation, please apply the following first:

yum -y remove elasticsearch

rm -rf /var/lib/elasticsearch

rm -rf /etc/elasticsearch


Fresh Elastic Search 7 Installation

Download and install the public signing key:

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


Create File elasticsearch.repo

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

 

Edit the file

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


Add the following content to it:

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

 

Install ElasticSearch

yum install -y --enablerepo=elasticsearch elasticsearch

 

 

After installation, Edit this config file

nano /etc/elasticsearch/jvm.options

 

Comment out this line by adding # at the beginning, or remove it

#-Djava.io.tmpdir=${ES_TMPDIR}

 

Add this line right after the above line or anywhere in the config file:

-Djava.io.tmpdir=/home/elasticsearch

 

Save and exit.

 

Create /home/elasticsearch folder and add it to the group elasticsearch

mkdir /home/elasticsearch

chown -R elasticsearch:elasticsearch /home/elasticsearch/

 

Install Java

yum -y install java-1.8.0-openjdk

 

Enable and Start Elastic search

systemctl enable elasticsearch

systemctl start elasticsearch

 

Check elasticsearch status

systemctl status elasticsearch

 

Test elasticsearch to make sure it's listening to port 9200

curl GET 'localhost:9200'

 

Done!

Tested on AlmaLinux 8.6.

  • elasticsearch, elasticsearch7, RHEL8, RockyLinux8, AlmaLinux8
  • 22 Users Found This Useful
Was this answer helpful?