How to install ElasticSearch on CentOS 7

How to install ElasticSearch on CentOS 7

Elasticsearch is an open-source java based search engine and is licensed under Apache. It is multitenant-capable full text based search engine with HTTP web interface and schema-free JSON documents.

To Install ElasticSearch

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 -y
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
--->  Package java-1.8.0-openjdk.x86_64 1:1.8.0.111-2.b15.el7_3 will be installed
-->  Processing Dependency: java-1.8.0-openjdk-headless = 1:1.8.0.111-2.b15.el7_3 for package: 1:java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64
.
.
.
Dependency Updated:
  chkconfig.x86_64 0:1.7.2-1.el7                     nspr.x86_64 0:4.11.0-1.el7_2             nss.x86_64 0:3.21.3-2.el7_3            nss-softokn.x86_64 0:3.16.2.3-14.4.el7     
  nss-softokn-freebl.x86_64 0:3.16.2.3-14.4.el7      nss-sysinit.x86_64 0:3.21.3-2.el7_3      nss-tools.x86_64 0:3.21.3-2.el7_3      nss-util.x86_64 0:3.21.3-1.1.el7_3         
  ntsysv.x86_64 0:1.7.2-1.el7                        tzdata-java.noarch 0:2016j-1.el7        

Complete!

Now download the package for ElasticSearch using the following command.

[root@linuxhelp ~]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.rpm
--2017-01-04 15:24:49--  https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.rpm
Resolving artifacts.elastic.co (artifacts.elastic.co)... 184.72.218.178, 23.21.105.193, 23.21.105.204, ...
Connecting to artifacts.elastic.co (artifacts.elastic.co)|184.72.218.178|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 33196711 (32M) [application/octet-stream]
Saving to: ‘ elasticsearch-5.1.1.rpm’ 

100%[=======================================================================================================================================> ] 33,196,711  39.0KB/s   in 10m 27s

2017-01-04 15:35:17 (51.7 KB/s) - ‘ elasticsearch-5.1.1.rpm’  saved [33196711/33196711]

After downloading ElasticSearch, install it using rpm command.

[root@linuxhelp ~]# rpm -ivh elasticsearch-5.1.1.rpm 
warning: elasticsearch-5.1.1.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:5.1.1-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

Now start and enable ElasticSearch service

[root@linuxhelp ~]# systemctl enable elasticsearch
ln -s ' /usr/lib/systemd/system/elasticsearch.service'  ' /etc/systemd/system/multi-user.target.wants/elasticsearch.service' 
[root@linuxhelp ~]# systemctl start elasticsearch
[root@linuxhelp ~]# systemctl status elasticsearch
elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service  enabled)
   Active: active (running) since Wed 2017-01-04 15:42:29 IST  9min ago
     Docs: http://www.elastic.co
  Process: 1296 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS)
 Main PID: 1310 (java)
   CGroup: /system.slice/elasticsearch.service
           ??1310 /bin/java -Xms2g -Xmx2g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+DisableExplicitGC -XX:+AlwaysP...

Jan 04 15:42:29 linuxhelp systemd[1]: Started Elasticsearch.
Jan 04 15:42:30 linuxhelp elasticsearch[1310]: OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should confi...CThreads=N
Hint: Some lines were ellipsized, use -l to show in full.

Now ElasticSearch has been installed to check it use the web browser and call the following link as http://localhost:9200

FAQ
Q
Does Amazon Elasticsearch Service support the open source Elasticsearch APIs?
A
Amazon Elasticsearch Service supports most of the commonly used Elasticsearch APIs, so the code, applications, and popular tools that you're already using with your current Elasticsearch environments work seamlessly. For a full list of supported Elasticsearch operations.
Q
Which Elasticsearch version does Amazon Elasticsearch Service support?
A
Amazon Elasticsearch Service currently supports Elasticsearch versions 6.3, 6.2, 6.0, 5.6, 5.5, 5.3, 5.1, 2.3, and 1.5.
Q
What is Amazon Elasticsearch Service?
A
Amazon Elasticsearch Service is a managed service that makes it easy to deploy, operate, and scale Elasticsearch clusters in the AWS Cloud.
Q
What is an Amazon Elasticsearch Service domain?
A
Amazon Elasticsearch Service domains are Elasticsearch clusters created using the Amazon Elasticsearch Service console, CLI, or API. Each domain is an Elasticsearch cluster in the cloud with the compute and storage resources you specify. You can create and delete domains, define infrastructure attributes, and control access and security. You can run one or more Amazon Elasticsearch Service domains.
Q
What does Amazon Elasticsearch Service manage on my behalf?
A
Amazon Elasticsearch Service manages the work involved in setting up a domain, from provisioning infrastructure capacity in the network environment you request to installing the Elasticsearch software. Once your domain is running, Amazon Elasticsearch Service automates common administrative tasks, such as performing backups, monitoring instances and patching software.