Learn How To Install Elasticsearch on a CentOS 7 Server Instance

January 15, 2019

Table of Contents

Elasticsearch is a popular open source full-text search and analytics engine. Thanks to its versatility, scalability, and ease of use, Elasticsearch is widely used as various applications’ underlying technology to provide complex search features.

In this introductory tutorial, I will explain how to install Elasticsearch on a single CentOS 7 node.


Before reading further, you should have:

  • Deployed An ITWeb.Services CentOS 7 server instance from scratch.
  • https://www.itweb.services/tutorials/linux-guides/hot-backups-with-percona-xtrabackup-on-the-one-click-wordpress-app”>IT Web Services article.

Step 1: Update your system

Update your system to the latest stable status:

sudo yum update
sudo reboot

After the reboot, still use the same user to log in.

Step 2: Install Java

You need to install Java before you can run Elasticsearch properly. Here, you can install OpenJDK 1.8.0 using the following command:

sudo yum install java-1.8.0-openjdk.x86_64

Then, you can verify your installation with this command:

java -version

Step 3: Install Elasticsearch

Import the Elasticsearch GPG key:

sudo rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch

Create an Elasticsearch repo:

sudo vi /etc/yum.repos.d/elasticsearch.repo

Copy the following code segment into the file:

name=Elasticsearch repository for 2.x packages

Save and quit:


Install Elasticsearch using YUM:

sudo yum install elasticsearch

Start Elasticsearch and set it to start on system boot:

sudo systemctl start elasticsearch.service
sudo systemctl enable elasticsearch.service

Step 4: Test Elasticsearch

After the installation, you can test Elasticsearch by using the curl command:

curl http://localhost:9200/

Upon success, a JSON document from Elasticsearch will be outputted to your terminal:

  "name" : "Legion",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.3.2",
    "build_hash" : "b9e4a6acad4008027e4038f6abed7f7dba346f94",
    "build_timestamp" : "2016-04-21T16:03:47Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.0"
  "tagline" : "You Know, for Search"

This example uses the default configuration. If you want to deploy Elasticsearch in a production environment, you should use a more customized configuration. You can learn more about configuring Elasticsearch from the official website.

Need help?

Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!