Install and Configure Elasticsearch on CentOS 7

Introduction

Elasticsearch is an open source distributed, RESTful search and analytics engine. Its popularity is due to its ease of use, powerful features, and scalability.

Elasticsearch supports RESTful operations. This means that you can use HTTP methods (GET, POST, PUT, DELETE, etc.) in combination with an HTTP URI (/collection/entry) to manipulate your data. The intuitive RESTful approach is both developer and user friendly, which is one of the reasons for Elasticsearch’s popularity.

In this article, we will see elasticsearch installation and configuration on centos 7.

 

Prerequisites

Elasticsearch is built using Java, and requires at least Java 8 in order to run. Only Oracle’s Java and the OpenJDK are supported. The same JVM version should be used on all Elasticsearch nodes and clients. Please visit our previous article to install and configure Java 8.

root@devops# java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

 

Install and Configure Elasticsearch

Step 1 –  Elasticsearch can be installed with a package manager by adding Elastic’s package repository. Run the following command to import the Elasticsearch public GPG key into rpm:

root@devops# rpm --import http://packages.elastic.co/GPG-KEY-elasticsearch

Step 2 – Create a new yum repository file for Elasticsearch.  Insert the following lines to the repository configuration file elasticsearch.repo

[elasticsearch-5.x]
name=Elasticsearch repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/5.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

Step 3 – Install the Elasticsearch package.

root@devops# yum install elasticsearch

Step 4 – Elasticsearch is now installed. Let’s edit the configuration, for configuration setting visit official website.

Step 5 – Start and enable the elasticsearch service.

root@devops# systemctl daemon-reload
root@devops# systemctl enable elasticsearch
root@devops# systemctl start elasticsearch

Step 6 – Allow traffic through TCP port 9200 in your firewall

root@devops# firewall-cmd --add-port=9200/tcp
root@devops# firewall-cmd --add-port=9200/tcp --permanent

Step 7 – Test installed Elasticsearch

root@devops# curl -X GET http://localhost:9200

That’s it from manual step by step elasticsearch installation and configuration on centos 7.
If you are familiar with Ansible IT automation tool then you can install Elasticsearch by one command. We have automated above all steps Elasticsearch installation by using Ansible Role. For that Ansible Role, please visit our article to install Elasticsearch with Ansible

 

See Also:

Install Elasticsearch with Ansible

ELK: How to install Elasticsearch, Logstash, Kibana (ELK Stack) on CentOS 7

Install Python Elasticsearch Client on CentOS 7 and It’s Usage

 

Avinash Pawar

DevOps Practitioner interested in learning new technologies and interested in sharing the knowledge with others.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle Plus

Avinash Pawar

DevOps Practitioner interested in learning new technologies and interested in sharing the knowledge with others.

Leave a Reply