Elasticsearch is a highly scalable open-source full-text search and analytics engine tool which helps you to store, search, and analyze big volumes of data in near real time. In this guide, I’ll show you the steps to install Elasticsearch 6 on CentOS 7 with Kibana to serve as Elastisearch Dashboard. Kibana lets you visualize your Elasticsearch data and navigate the Elastic Stack
How to Install Elasticsearch 6 on CentOS 7
As Elasticsearch depends on Java, you need it installed on your machine prior to installing Elasticsearch 6 on CentOS 7.
sudo yum install java-openjdk-devel java-openjdk
After it is installed, set Java environment variables
cat > /etc/profile.d/java8.sh <<EOF
export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))
export PATH=\$PATH:\$JAVA_HOME/bin
export CLASSPATH=.:\$JAVA_HOME/jre/lib:\$JAVA_HOME/lib:\$JAVA_HOME/lib/tools.jar
EOF
Add Elasticsearch 6 repository:
cat > /etc/yum.repos.d/elasticsearch.repo <<EOF
[elasticsearch-6.x]
name=Elasticsearch repository for 6.x packages
baseurl=[https://artifacts.elastic.co/packages/6.x/yum](https://artifacts.elastic.co/packages/6.x/yum)
gpgcheck=1
gpgkey=[https://artifacts.elastic.co/GPG-KEY-elasticsearch](https://artifacts.elastic.co/GPG-KEY-elasticsearch)
enabled=1
autorefresh=1
type=rpm-md
EOF</pre>
Elasticsearch 6 repository is ready for use. You can install Elasticsearch using the command below:
sudo yum install elasticsearch
You can set JVM options like memory limits by editing the file:
/etc/elasticsearch/jvm.options
Start and enable elasticsearch service on boot:
$ sudo systemctl start elasticsearch
$ sudo systemctl enable elasticsearch
Created symlink from /etc/systemd/system/multi-user.target.wants/elasticsearch.service to /usr/lib/systemd/system/elasticsearch.service.
Test to verify that it is working:
# curl [http://127.0.0.1:9200](http://127.0.0.1:9200/) { "name" : "z55vMi1", "cluster_name" : "elasticsearch", "cluster_uuid" : "AdPjPVvWRkOZKC0ADLarXw", "version" : { "number" : "6.3.2", "build_flavor" : "default", "build_type" : "rpm", "build_hash" : "053779d", "build_date" : "2018-07-20T05:20:23.451332Z", "build_snapshot" : false, "lucene_version" : "7.3.1", "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" : "You Know, for Search" }
Create a test index:
$ curl -X PUT "[http://127.0.0.1:9200/mytest_index](http://127.0.0.1:9200/mytest_index)"
{"acknowledged":true,"shards_acknowledged":true,"index":"mytest_index"}</pre>
Install Kibana on CentOS 7
sudo yum install kibana
After a successful installation, configure Kibana
$ sudo vim /etc/kibana/kibana.yml**
server.host: "0.0.0.0"
server.name: "[kibana.example.com](http://kibana.example.com/)"
elasticsearch.url: "[http://localhost:9200](http://localhost:9200/)"</pre>
Change other settings as desired then start kibana service:
sudo systemctl start kibana
sudo systemctl enable kibana
Access** http://ip-address:5601** to open Kibana Dashboard:
elasticsearch-kibana-centos7-min.png
If you have an active firewall, you’ll need to allow access to Kibana port:
sudo firewall-cmd --add-port=5601/tcp --permanent
sudo firewall-cmd --reload