How To Install Elasticsearch On Centos7.6
Installation Of Elasticsearch On Centos 7.6
Elasticsearch is an open source, distributed full-text search engine based on the Lucene Library. It developed in Java. In This tutorial covers the basic installation process of Elasticsearch on CentOS 7.6
Installation process
ElasticSearch requires Java 8 for its functioning, so use the following command to install Java
[root@linuxhelp ~]# yum install java-1.8.0-openjdk.x86_64
BDB2053 Freeing read locks for locker 0xa2d: 17378/140593153771328
BDB2053 Freeing read locks for locker 0xa2f: 17378/140593153771328
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.excellmedia.net
* extras: centos.excellmedia.net
* updates: centos.excellmedia.net
Resolving Dependencies
--> Running transaction check
.
.
.
Dependencies Resolved
=======================================================================================================
Package Arch Version Repository Size
=======================================================================================================
Updating:
java-1.8.0-openjdk x86_64 1:1.8.0.252.b09-2.el7_8 updates 295 k
Installing for dependencies:
Upgrade 1 Package (+1 Dependent package)
Total size: 33 M
Total download size: 34 k
Is this ok [y/d/N]: y
Updated:
java-1.8.0-openjdk.x86_64 1:1.8.0.252.b09-2.el7_8
Dependency Updated:
java-1.8.0-openjdk-headless.x86_64 1:1.8.0.252.b09-2.el7_8
Complete!
If you want to check the java version you’ve just installed by using the following command
[root@linuxhelp ~]# java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
You can download the package for ElasticSearch using the following command.
[root@linuxhelp ~]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.8.0-x86_64.rpm
--2020-07-08 16:22:26-- https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.8.0-x86_64.rpm
Resolving artifacts.elastic.co (artifacts.elastic.co)... 151.101.2.222, 151.101.66.222, 151.101.130.222, ...
Connecting to artifacts.elastic.co (artifacts.elastic.co)|151.101.2.222|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 319213800 (304M) [application/octet-stream]
Saving to: ‘elasticsearch-7.8.0-x86_64.rpm’
100%[=============================================================>] 319,213,800 1.11MB/s in 5m 11s
2020-07-08 16:27:38 (1001 KB/s) - ‘elasticsearch-7.8.0-x86_64.rpm’ saved [319213800/319213800]
Once the download is completed, you can install the Elasticsearch by using the following command
[root@linuxhelp ~]# rpm -ivh elasticsearch-7.8.0-x86_64.rpm
warning: elasticsearch-7.8.0-x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID d88e42b4: NOKEY
Preparing... ################################# [100%]
Creating elasticsearch group... OK
Creating elasticsearch user... OK
Updating / installing...
1:elasticsearch-0:7.8.0-1 ################################# [100%]
### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service
### You can start elasticsearch service by executing
sudo systemctl start elasticsearch.service
Created elasticsearch keystore in /etc/elasticsearch/elasticsearch.keystore
And then reload the daemon service by triggering the following command.
[root@linuxhelp ~]# systemctl daemon-reload
After that, you can start elasticsearch by using the following command
[root@linuxhelp ~]# systemctl start elasticsearch
Once it is started, enter into the elasticsearch configuration file and change the following line
[root@linuxhelp ~]# vim /etc/elasticsearch/elasticsearch.yml
network.host:192.168.7.228
http.port: 9200
Once it is done, check the elasticsearch status by running the following command.
[root@linuxhelp ~]# systemctl status elasticsearch.service
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2020-07-08 16:32:21 IST; 1min 29s ago
Docs: https://www.elastic.co
Process: 20082 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=78)
Main PID: 20082 (code=exited, status=78)
Jul 08 16:31:29 linuxhelp systemd[1]: Starting Elasticsearch...
Jul 08 16:32:20 linuxhelp systemd-entrypoint[20082]: ERROR: [1] bootstrap checks failed
Jul 08 16:32:20 linuxhelp systemd-entrypoint[20082]: [1]: the default discovery settings are unsui...ed
Jul 08 16:32:20 linuxhelp systemd-entrypoint[20082]: ERROR: Elasticsearch did not exit normally - ...og
Jul 08 16:32:21 linuxhelp systemd[1]: elasticsearch.service: main process exited, code=exited, s.../n/a
Jul 08 16:32:21 linuxhelp systemd[1]: Failed to start Elasticsearch.
Jul 08 16:32:21 linuxhelp systemd[1]: Unit elasticsearch.service entered failed state.
Jul 08 16:32:21 linuxhelp systemd[1]: elasticsearch.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
If you get the bootstrap error go back to elasticsearch configuration and enter the command in following line 44
[root@linuxhelp ~]# vim /etc/elasticsearch/elasticsearch.yml
bootstrap.system_call_filter: false
And then go to the line number 71
discovery.seed_hosts: 192.168.7.228
Once the configuration is completed start the elasticsearch
[root@linuxhelp ~]# systemctl start elasticsearch
Now check the status of elasticsearch
[root@linuxhelp ~]# systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2020-07-08 16:36:26 IST; 27s ago
Docs: https://www.elastic.co
Main PID: 20479 (java)
Tasks: 45
CGroup: /system.slice/elasticsearch.service
├─20479 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=...
└─20634 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller
Jul 08 16:35:40 linuxhelp systemd[1]: Starting Elasticsearch...
Jul 08 16:36:26 linuxhelp systemd[1]: Started Elasticsearch.
After it is done, go to the browser and enter the ip address and port number