Installing ElasticSearch 6 on CentOS 7.5

Posted July 11th, 2018

*The Base Image for this tutorial is a Digital Ocean CentOs 7.5 Image with 4GB Memory and 25GB Diskspace.


1. Connecting to your Server

You will need a SSH-Client like Putty if you are coming from Windows. On Unix-OS like OSX and Linux you can use terminal.

After connecting to the server you will be greeted by the following screen:


2. If you are logged in as root, it is highly recommended that you create another account and add this account to the wheel group. To achieve this, you have to type the following on the terminal.

adduser <username>

where <username> can be any name you would like to have for the account. For this tutorial, we are going to create the user “corefinity”.

adduser corefinity

After hitting Enter, you need to assign a password to this user, as it won’t be enabled like in Ubuntu without doing so. To achieve this, you need to type

passwd corefinity

and repeat the password twice. You now have created your first user.

Unfortunately, this user doesn’t have any root-permissions yet, but we are going to change this now

As we are still logged in as root, we are now going to add our corefinity-user to the group of wheel.

usermod -aG wheel corefinity

will achieve this. We now have a non-root account, which can install software and updates.

To switch to this user, we need to type

su corefinity

and to exit this user and return to root, we just need to type


and hit enter.


3. The first step you will need to do is updating your base image. Under our newly created corefinity-user, we need to type the following:

sudo yum update -y

and run the command by hitting enter. This will update yum’s packages and look similar to the following screenshot.


4. Now we need to install Java, to make ElasticSearch work.

To do so, we need to type

sudo yum install java-1.8.0-openjdk.x86_64 nano –y

To verify the successful installation we can type

java –version

and see the currently installed version.

After the installation is complete, we need to import the public key of the ElasticSearch repository by typing

sudo rpm –import

If this is done, we now need to create a new file in /etc/yum.repos.d by the name of elasticsearch.repo with

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

and propagate it via copy/paste with the following content





name=Elasticsearch repository for 6.x packages










Afterwards we can save the file with ctrl-o and exit it with ctrl-x. Now we are able to install ElasticSearch via yum with

sudo yum install elasticsearch -y

As soon, as the installation is complete, we can run Elasticsearch with the following command

sudo systemctl enable elasticsearch.service


sudo systemctl start elasticsearch.service

To see if everything’s running fine, we can type

sudo systemctl status elasticsearch.service

and see an output similar to the following screenshot:

For the final test, we are going to run curl with the following parameters:

curl http://localhost:9200

and should get an output similar to this:

Congratulations, you got ElasticSearch up and running on your server!