How to install Elasticsearch on CentOS 7
I. What is Elasticsearch?
Elasticsearch is a search engine based on Lucene software. It provides a full-featured, distributed search engine with an HTTP web interface that supports JSON data. Elasticsearch is developed in Java and is released as open source under the Apache license.
To put it more simply:
Elasticsearchactually acts as a web server, capable of fast search (near realtime) through RESTful protocol.
ElasticsearchCapable of data analysis and statistics
Elasticsearchruns on its own server and concurrently communicates via RESTful so it doesn’t depend on what the client is written in or what your current system is written in. So integrating it into your system is easy, you just need to send an http request and it will return results.
ElasticsearchIt is a distributed system with excellent scalability. Add a node to it and it will automatically expand for you.
open sourcedeveloped with
II. Install Elasticsearch on CentOS 7
To install Elasticsearch on CentOS 7 we need to follow the following X steps.
Step 1: SSH into your server
To install Elasticsearch on CentOS 7, we first need to SSH or access your VPS or server with root privileges first.
After successfully SSHing, we continue with step 2 to install Java, because Elasticsearch requires the server to install Java first to allow the installation.
Step 2: Install Java 8 on CentOS 7
Because Elasticsearch only requires Java 8 version, I will guide you to install Java 8 version with the command below.
yum -y install java-1.8.0-openjdk.x86_64
After installing Java, you can check again with the following command.
If the results are returned as below, you have successfully installed Java 8.
Step 3: Install Elasticsearch on CentOS 7
The process of installing Elasticsearch is also relatively simple, you just need to follow the commands below, and of course I will explain each command clearly for your peace of mind.
First we will need to download the Elasticsearch installation file with the format
This file is about 300MB in size, so it may take some time to download.
Download the Elasticsearch installation file.
Then we install Elasticsearch with the downloaded file with the following command:
rpm -ivh elasticsearch-7.8.0-x86_64.rpm
We then need to restart the service
daemon-reloadby activating the following command:
We then start Elasticsearch with the following command:
systemctl start elasticsearch
And after Elasticsearch has finished starting, we can check the operating status of Elasticsearch with the following command:
systemctl status elasticsearch.service
So far you can verify that Elasticsearch is running by sending an HTTP request to port 9200 on localhost with the
curl -X GET "localhost:9200/"
If the results are returned like the following, then you are successful:
Step 4: Enable Remote Access Elasticsearch
However, so far we can only use Elasticsearch right on the local computer. If you want external users to connect to port 9200 then you need to open port 9200 and do a few more steps.
Edit the configuration file of Elasticsearch with the command below:
Move to the line
#this line and edit it to the content below:
72and edit it to the following content:
We will then need to restart Elasticsearch with the following command:
systemctl start elasticsearch
That’s it, now you can completely connect to your server remotely via port 9200 as shown below.
At this point, the installation of Elasticsearch on CentOS 7 has been successful.
Although the article on installing Elasticsearch on CentOS 7 is relatively long and has many complicated sections, I hope you can do it all. You can now visit the official Elasticsearch Documentation page and learn how to get started with Elasticsearch.