Elasticsearch Installation How-To (Centos 7)

Published on Author gryzli

Elasticsearch install is pretty straight forward (also making cluster of elastic nodes).The following howto is about installing elasticsearch 6.x, which is the current latest version.

It is good to know some basic concepts of ElasticSearch before using it. 

I’m not going to talk about the hardware requirements, because they strongly depend on the setup and the data that’s going to be inserted into the cluster.There is one thing, that should be always considered and it is : make sure you have enough RAM on your cluster nodes.

There are some guidance about the hardware to use for elasticsearch , which you can find here :



In the following setup I assume you have 2 servers :



hostname: elastic-node1

Big disk mount: /data

elastic cluster name: my-cluster

OS: Centos7



hostname: elastic-node2

Big disk mount: /data

elastic cluster name: my-cluster

OS: Centos7


1/ Installing Elasticsearch

The easiest way for installing elasticsearch is to use the repository for Centos 7.

The following steps should be done on both of your cluster nodes.

Add elastic repo

Adding the repository to yum is as easy as doing :

vim /etc/yum.repos.d/elasticsearch-6.x.repo


Install openjdk

yum install java-1.8.0-openjdk


Install Elasticsearch

yum install elasticsearch

systemctl enable elasticsearch


Make sure you edit your systemd service file and have the following inside:

vim /lib/systemd/system/elasticsearch.service

2/ Configuring Elasticsearch


Configuring elastic nodes

(Configuration  for elastic-node2 should be the same, you should only change IP/Hostname to the appropriate ones for the second node)


1) Editing /etc/elasticsearch/elasticsearch.yml

vim /etc/elasticsearch/elasticsearch.yml


Edit the following options:


2) Configure logging

Logging options of ElasticSearch could be controlled by modifying the following file :




3) Configure JVM options

One very important thing is to correctly configure your memory settings inside your JVM config:

vim /etc/elasticsearch/jvm.options

You should change accordingly:

Depending on your setup / use-case you may configure 2,3,4G of memory.

If the machine is going to be elastic-node dedicated machine, you could put up to 80-85% of your memory.


4) (Optional) Add hard-coded records to your hosts file

This step is optional, but I’m doing it when setting up elastic cluster in the sake of safety.

I’m adding hard-coded host to IP mappings for all nodes in the cluster to their /etc/hosts files. By doing this I’m making sure that cluster nodes will see each other even if there is some DNS related problem.

These lines should be added to all of the nodes inside your ES cluster:

vim /etc/hosts


5) Fix firewall on both nodes (elastic-node1 / elastic-node2)

Make sure to enable connection between your elastic nodes .

Each node should be able to access the TCP port range of 9200 – 9400 of the other nodes.


3/ Final

We are done , now you need only to restart your elasticsearch services and make sure everything is okay.

systemctl restart elasticsearch


You should check your cluster status and make sure it is working properly:

elastic-node1# curl http://elastic-node1:9200/_cluster/health?pretty

Make sure you see “status”:”green”.


Now you can proceed with installing Kibana , which is a great tool for working with your cluster and visualizing data.