How to install Elasticsearch on CentOS / Red Hat
-
Install the latest
Java Runtime Environment
.# yum install -y java-1.8.0-openjdk
-
Add
Elasticsearch
repository toyum
.-
Download and install the public signing key.
# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
-
Add the following lines to
/etc/yum.repos.d/elasticsearch.repo
.[elasticsearch-6.x] name=Elasticsearch repository for 6.x packages baseurl=https://artifacts.elastic.co/packages/6.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md
-
-
Install
Elasticsearch
package along with dependencies.# yum install -y elasticsearch
-
Configure
Elasticsearch
if necessary by editing/etc/elasticsearch/elasticsearch.yml
. -
Configure firewall for
Elasticsearch
service.-
Enable network access to port
9200
and9300
.# firewall-cmd --permanent --add-port=9200/tcp # firewall-cmd --permanent --add-port=9300/tcp
-
Reload firewall rules and keep state information.
# firewall-cmd --reload
-
-
Configure
Elasticsearch
service to automatically start during boot.# systemctl enable elasticsearch
-
Start
Elasticsearch
service.# systemctl start elasticsearch
The service will take a while to start
-
Test if installation is successful.
$ curl 127.0.0.1:9200 { "name" : "8v4rGQI", "cluster_name" : "elasticsearch", "cluster_uuid" : "nkZIqfkpSyCdh_jg3nqWfw", "version" : { "number" : "6.2.2", "build_hash" : "10b1edd", "build_date" : "2018-02-16T19:01:30.685723Z", "build_snapshot" : false, "lucene_version" : "7.2.1", "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" : "You Know, for Search" }