In 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:
- 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]
- Install ElasticSearch public signing key:
[bash]rpm –import https://packages.elastic.co/GPG-KEY-elasticsearch[/bash]
- 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:
[bash]
[elasticsearch-1.7]
name=Elasticsearch repository for 1.7.x packages
baseurl=http://packages.elastic.co/elasticsearch/1.7/centos
gpgcheck=1
gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1
[/bash] - Next is the easiest part: install it using yum
[bash]yum install -y elasticsearch[/bash]
- Next is start ElasticSearch service in CentOS6:
[bash]service elasticsearch start[/bash]
or
[bash]systemctl start elasticsearch[/bash]
in CentOS7
- 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.