Install elasticsearch on CentOS 7
To install elasticsearch, first install java
1 |
yum -y install java-1.8.0-openjdk |
Import key
1 |
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch |
Create file
1 |
vi /etc/yum.repos.d/elasticsearch.repo |
Paste following
1 2 3 4 5 6 7 8 |
[elasticsearch] name=Elasticsearch repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=0 autorefresh=1 type=rpm-md |
Install elasticsearch
1 |
yum install --enablerepo=elasticsearch elasticsearch |
Set elastic search to start on boot
1 |
systemctl enable elasticsearch |
To start/stop/status
1 2 3 |
systemctl stop elasticsearch.service systemctl start elasticsearch.service systemctl status elasticsearch.service |
To see logs
1 |
tail -f /var/log/elasticsearch/elasticsearch.log |
ElasticSearch runs on port 9200
1 2 3 4 5 6 |
[root@server ~]# netstat -lntp | grep java tcp6 0 0 127.0.0.1:9200 :::* LISTEN 1289/java tcp6 0 0 ::1:9200 :::* LISTEN 1289/java tcp6 0 0 127.0.0.1:9300 :::* LISTEN 1289/java tcp6 0 0 ::1:9300 :::* LISTEN 1289/java [root@server ~]# |
If you get error starting elasticsearch, check Elasticsearch failed to start on CentOS 7
If you have a previous installation, make sure you delete left over files before you install differnt version of elasticsearch. I removed following files/folders when i had to downgrade elasticsearch.
1 2 3 |
/etc/sysconfig/elasticsearch.rpmsave /var/lib/elasticsearch /var/log/elasticsearch |
See elasticsearch