Install ElasticSearch on CentOS

150-X-150-Elasticsearch-LogoIn this tutorial, I will write down step-by-step guide on how to install ElasticSearch on CentOS. Well, if you do not know what is ElasticSearch, then it can be defined as follows:

Elasticsearch is a search server based on Lucene. It provides a distributed, multitenant-capable full-text search engine with a RESTful web interface and schema-free JSON documents. Elasticsearch is developed in Java and is released as open source under the terms of the Apache License.

Comparing ElsaticSearch to other search engines such as SphinX, Solr, and even Lucene, I prefer this solution since it is built for easy scalability. Some other solutions can also be scaled, as Solr Cloud and Solr Cluster, however they all did not target on scalability from its original architecture design, so I prefer to use ElasticSearch 🙂

Belows are necessary steps that you might be waiting for:

  1. Install Java. Since it is recommended to use java from 1.8.x, so just use it

    [bash]yum install -y java-1.8.0-openjdk[/bash]

  2. Install ElasticSearch public signing key:

    [bash]rpm –import[/bash]

  3. We will create a new repo file to be able to install ElasticSearch from the provider’s repository. We will create a new file /etc/yum.repos.d/elasticsearch.repo of which content is as follows:

    name=Elasticsearch repository for 1.7.x packages

  4. Next is the easiest part: install it using yum

    [bash]yum install -y elasticsearch[/bash]

  5. Next is start ElasticSearch service in CentOS6:

    [bash]service elasticsearch start[/bash]


    [bash]systemctl start elasticsearch[/bash]

    in CentOS7

  6. Finally, allow it to start when the system is started/rebooted:

    [bash]chkconfig –add elasticsearch[/bash]

    or in CentOS7:

    [bash]systemctl enable elasticsearch[/bash]

All is done. You can now start communicating with ElasticSearch on the 9200 port.

About NhocConan

A super lazy guy who tries to write tech blog entries in English.He is lazy, so he can only write when he is in a good mood or when he is tired of coding.

Leave a comment

Your email address will not be published. Required fields are marked *