How to install Elasticsearch

Elasticsearch is an incredibly powerful search engine in which data can be stored and recalled in real-time. Because of the speed and reliability of Elasticsearch, it is highly recommended if you are searching through large amounts of data on a regular basis. Thanks to projects like ElasticPress, it can also be used easily within WordPress as a replacement for the default search. In this article, we will show you how to install Elasticsearch on InMotion Hosting or any other CentOS/Red Hat based system.

Note: You will need to have a VPS or dedicated server with root access to be able to install Elasticsearch.

Installing Elasticsearch from the repository

The easiest way to install Elasticsearch is from their repositories. Doing so is not only simple to install, but will also allow you to easily keep Elasticsearch updated.

  1. First, SSH into your server as root.
  2. Now, as Elasticsearch depends on Java to run, we will need to begin installing Java on the server. To do so, first begin by updating the repositories:

    yum update

    Now, install Java:

    yum install java

    If all goes well, Java should now be installed on the server and you are ready to begin installing Elasticsearch.

  3. Next, we will add the Elasticsearch repository to the server. Begin by adding the public signing key:

    rpm –import

  4. Now, we need to add the actual repository. Use the following to open a text editor and create a new file holding the Elasticsearch repository:

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

    Within the text editor, paste in the following:

    [elasticsearch-6.x] name=Elasticsearch repository for 6.x packages

    Once entered, press Ctrl+X and then the Y key to save changes.

  5. Now that the repository is set up, Elasticsearch is ready to install. To do so, enter the following:

    yum install elasticsearch

    Elasticsearch will now be installed. Once complete, if you want it to automatically start when the system is booted, follow the next section on setting ElasticSearch as a system service.

Setting ElasticSearch as a system service

If you want Elasticsearch to automatically when the system is started, enter the following command to see it as a system service:

chkconfig –add elasticsearch


If you’re using Systemd, enter the following command instead:

systemctl enable elasticsearch

Elasticsearch with WordPress

In addition to Elasticsearch’s many use cases, individuals can easily integrate Elasticsearch with WordPress. For more information on doing so, take a look at our article on Elasticsearch in WordPress using ElasticPress.

Thoughts on “How to install Elasticsearch

  • How does one make this CageFS (CloudLinux) compatible? I’ve tried my regular methods, but I cannot seem to get it carried throughout the Cage.

  • Can this installation happen on your shared hosting packages ?! Or is it a must to have a VPS to make this work ?

    • This must be performed on a VPS at least, because it requires root access. However, if you have WordPress, there are plugins like Jetpack which uses Elasticsearch in their premium version to make searching your site faster.

  • Thx for your guide, it was almost perfect in my case. What I changed was, in step 4:



    name=Elasticsearch repository for 1.7.x packages






    And then 

    sudo nano /etc/elasticsearch/elasticsearch.yml

    using these options:

    http.port: 9200

    And finally,

    sudo service elasticsearch start


    • Hello Amit,

      Thank you for contacting. We recently tested this article successfully, and everything seems to be working.

      What issues are you having with the guide?

      Are getting any errors? What are they?

      Thank you,

  • This page needs updated, the URL for the repository is now Also, newer versions exist beyond 1.4.


  • Hello,

    After struggling a bit, I managed to get it running. For some reasons, my webservices which are calling the elastic client, are only working inside a specific folder.

    Thanks anyway!

  • Hello,

    One of the reason I chose inmotion for my website is because it provides a tutorial for installing elasticsearch, which is present in my website. I have already followed all the steps successfully. But the service is not working on the website. I am getting the following error response on php services that creates an elastic search client :

    Fatal error: Class ‘Elasticsearch\Client’ not found in /home/catove5/public_html/catovert/gateway/app/init.php on line 5

    Can you please indicate what should be done next to get it running on the website?

Was this article helpful? Let us know!