Install Elasticserach version 7 on RedHat

Install Elasticserach version 7 on RedHat and secure it with self signed certificates and RBAC

Download and install public key

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

Create a file called elasticsearch.repo in the /etc/yum.repos.d/ directory for RedHat based distributions-> change path, create and edit the file.

touch elasticsearch.repo

nano elasticsearch.repo


Add the following parameters in the file:

[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=0

autorefresh=1

type=rpm-md


And your repository is ready for use. You can now install Elasticsearch using the following command.

sudo yum install --enablerepo=elasticsearch elasticsearch

Configure Elasticsearch to start automatically when the system boots up, and check it's status"

systemctl daemon-reload

systemctl enable elasticsearch.service

systemctl status elasticsearch

systemctl start elasticsearch


Check if your server is up:

curl -X GET "localhost:9200/?pretty"


Configuring elasticsearch: browse to the elasticsearch path and modify the configuration file as below:

cd /etc/elasticsearch

nano elasticsearch.yml

cluster.name: elasticsearchclustername

node.name: FQDN 

network.host: hostnameip

discovery.seed_hosts: ["hostnameip1", "hostnameip2", "hostnameip3"]

cluster.initial_master_nodes: ["hostnameip1"]

Restart service

systemctl restart elasticsearch