This tutorial discusses how to install ElasticSearch 7.x on CentOS 7. Elasticsearch is an open source search and analysis engine that allows you to store, search, and analyze large amounts of data in real time. ElasticSearch provides support for millions of applications that rely on intensive search operations such as e-commerce platforms and big data applications.
As of this update, the latest version of ElasticSearch is 7. We will cover the minimum steps required to install ElasticSearch 7 on CentOS 7 Linux systems. let's start.
sudo yum -y update
sudo reboot
ElasticSearch requires Java to be installed to run. The default Java that can be installed on CentOS 7 is Java 8. Below are the commands used for installation.
sudo yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
Set Java home
cat <<EOF | sudo tee /etc/profile.d/java8.sh
export JAVA_HOME=/usr/lib/jvm/jre-openjdk
export PATH=\$PATH:\$JAVA_HOME/bin
export CLASSPATH=.:\$JAVA_HOME/jre/lib:\$JAVA_HOME/lib:\$JAVA_HOME/lib/tools.jar
EOF
Source created file to update your environment.
source /etc/profile.d/java8.sh
Add the repository for downloading the ElasticSearch 7 yum package to the CentOS 7 system.
cat <<EOF | sudo tee /etc/yum.repos.d/elasticsearch.repo
[ elasticsearch-7.x]
name=Elasticsearch repository for7.x packages
baseurl=https://artifacts.elastic.co/packages/oss-7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF
If you want to install Elasticsearch 6, replace all matches of 7 with 6. After adding the repository, clear and update the YUM package index.
sudo yum clean all
sudo yum makecache
Finally, install ElasticSearch 7.x on the CentOS 7 computer. Please note that we added an open source repository. Other commercial repositories can also be used.
sudo yum -y install elasticsearch-oss
Confirm to install ElasticSearch 7 on CentOS 7:
$ rpm -qi elasticsearch-oss
Name : elasticsearch-oss
Epoch :0
Version :7.4.0
Release :1
Architecture: x86_64
Install Date: Thu 17 Oct 201905:10:43 AM UTC
Group : Application/Internet
Size :395896718
License : ASL 2.0
Signature : RSA/SHA512, Fri 27 Sep 201910:40:01 AM UTC, Key ID d27d666cd88e42b4
Source RPM : elasticsearch-oss-7.4.0-1-src.rpm
Build Date : Fri 27 Sep 201908:49:06 AM UTC
Build Host : packer-virtualbox-iso-1559162487
Relocations :/usr
Packager : Elasticsearch
Vendor : Elasticsearch
URL : https://www.elastic.co/
Summary : Distributed RESTful search engine built for the cloud
Description :
Reference documentation can be found at
https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
and the 'Elasticsearch: The Definitive Guide' book can be found at
https://www.elastic.co/guide/en/elasticsearch/guide/current/index.html
You can edit the file to set JVM options (such as memory limit): /etc/elasticsearch/jvm.options
The following example sets the initial/maximum value of the total heap space
$ sudo vi /etc/elasticsearch/jvm.options
.....- Xms1g
- Xmx1g
If the system has less memory, you can configure it to use small megabytes of memory.
- Xms256m
- Xmx512m
Automatically start the Elasticsearch service at boot:
sudo systemctl enable --now elasticsearch
Confirm that the service is running.
$ sudo systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
Loaded:loaded(/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
Active:active(running) since Thu 2019-10-1705:16:00 UTC; 13s ago
Docs:[http://www.elastic.co](http://www.elastic.co/)
Main PID:8774(java)
CGroup:/system.slice/elasticsearch.service
└─8774/usr/share/elasticsearch/jdk/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75-XX:+UseCMSI...
Oct 1705:15:46 cent7.novalocal systemd[1]: Starting Elasticsearch...
Oct 1705:15:46 cent7.novalocal elasticsearch[8774]: OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in versio...elease.
Oct 1705:16:00 cent7.novalocal systemd[1]: Started Elasticsearch.
Hint: Some lines were ellipsized, use -l to show in full.
Check if you can connect to the Elasticsearch service
$ curl http://127.0.0.1:9200{"name":"cent7.novalocal","cluster_name":"elasticsearch","cluster_uuid":"SmGu9eXJRlGzxqEy2brGXQ","version":{"number":"7.4.0","build_flavor":"oss","build_type":"rpm","build_hash":"22e1767283e61a198cb4db791ea66e3f11ab9910","build_date":"2019-09-27T08:36:48.569419Z","build_snapshot":false,"lucene_version":"8.2.0","minimum_wire_compatibility_version":"6.8.0","minimum_index_compatibility_version":"6.0.0-beta1"},"tagline":"You Know, for Search"}
Related Elasticsearch packages, such as Kibana, Logstash, etc. can be installed from the added repository. .
sudo yum install kibana-oss
After successful installation, configure Kibana:
$ sudo vi /etc/kibana/kibana.yml
server.host:"0.0.0.0"
server.name:"http://kibana.example.com"
elasticsearch.url:"http://localhost:9200"
Set the kibana service to start with the system:
sudo systemctl enable --now kibana
If you have an active firewall, you need to allow access to the Kibana port:
sudo firewall-cmd --add-port=5601/tcp --permanent
sudo firewall-cmd --reload
Access to open the kibana dashboard http://ip-address:5601
Install Logstash with this command:
sudo yum install logstash
Recommended Posts