Get 50% Discount Offer 7 Days


Contact Info

Chicago 12, Melborne City, USA

+88 01682648101

[email protected]

Recommended Services
Supported Scripts
Configure Elasticsearch on CentOS8

This is a tutorial on how to install and Configure Elasticsearch on CentOS 8, 7 step by step. In today’s world of technology, large amounts of data are generated every day at approximately 2.5 quintillion bytes or about 2.5 billion bytes. This information comes mainly from a variety of sources, such as mass media sites, video-sharing sites, and media for large organizations. This data is called the ocean of data or, more generally, the Big Data. A significant portion of this data is unstructured and fragmented, and one needs analytical tools to understand it. There are many analytical tools on the market that can be used to review, record, analyze, and process this data. One of the most widely used tools is Elasticsearch. So in this article, we want to teach you about Tutorial Configure Elasticsearch on CentOS 8.

Introduction to Elasticsearch and its features

Elasticsearch is a product of a company called Elastic, which was founded in 2012. Elasticsearch, a search engine developed in Java, is an open-source tool. It is designed to handle unstructured data from different sources and store it in an optimized format for efficient text search. At its core, Elasticsearch utilizes Lucene Apache for indexing and searching purposes. Lucene is a really complicated library to work with; Elasticsearch eliminates all the hassle by providing API usability. The API is a RESTful HTTP API that uses JSON as the data exchange format; As a result, using Elasticsearch, a large amount of data can be stored and analyzed quickly and efficiently. This is especially useful when dealing with semi-structured natural language data.

Applications with complex search requirements, like big e-commerce stores and analytic applications, often rely on Elasticsearch as their search engine of choice. Elasticsearch has gained significant popularity due to its ability to power such applications effectively. There are many benefits to using Elasticsearch. One of these advantages is its scalability, which means that as the volume of data increases, the performance remains very simple and the results are reliable. Elasticsearch uses reverse indexing. Reverse indexing is a word-based method used to quickly search for documents containing a particular word. Another feature of Elasticsearch is that it is multilingual.

Install Java on CentOS 8

First, you must install the Java application because Elasticsearch is a Java application. Then if Java is installed, check its version using the Java grammar in CMD.

You should run the following command as a user or root with the Sudo privileges command to install the OpenJDK:

Sudo dnf install java-11-OpenJDK-devel

Then you must also print the Java version to verify the Java installation:

java -version

The output should be as follows:

OpenJDK version "11.0.5" 2019-10-15 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.5+10-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.5+10-LTS, mixed mode, sharing)

How to Install Elasticsearch on CentOS 8

First, you can download Elasticsearch directly from the Elastic site. Because rpm installs everything you need to run Elasticsearch, you should use the rpm package for CentOS 8 Linux VPS.

The first step is to import the repository’s GPG using the following command:

sudo rpm --import

Then you need to open your text editor by executing the following command and create the repository file in the /etc/yum.repos.d directory:

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

You should now paste the following commands in the file:

name=Elasticsearch repository for 7.x packages

In order for the changes you made to take effect, you must save the file and exit it.

Next, you need to install the Elasticsearch package using the following command:

sudo dnf install elasticsearch

Now that you have successfully completed the installation process, you can start and activate the service by running the following command:

sudo systemctl enable elasticsearch.service --now

To check if Elasticsearch is running, you can use the following command. Note that you can use curl to send an HTTP request to port 9200 on localhost:

curl -X GET "localhost:9200/"

Finally, you can view the messages recorded by the Elasticsearch service using the following command:

sudo journalctl -u elasticsearch

How to Configure Elasticsearch on CentOS 8

In this section, we will look at how to configure Elasticsearch. Note that Elasticsearch data is stored in the /var/lib/elasticsearch directory. Configuration files are also in /etc/elasticsearch. It should note that by default, Elasticsearch is configured to listen only on localhost. So if the client connected to the database also runs on the same host and you are setting up a single cluster, there is no need to change the default configuration file.

You must configure your firewall to allow remote access to the Elasticsearch server. It is, therefore, necessary to grant access to the Elasticsearch port 9200  only through trusted clients. Suppose you want to allow connection only through IP 123.456.789.01 on port 9200. This command is enabled using the following commands:

sudo firewall-cmd --new-zone=elasticsearch --permanent
sudo firewall-cmd --reload
sudo firewall-cmd --zone=elasticsearch --add-source=123.456.789.01/32 --permanent
sudo firewall-cmd --zone=elasticsearch --add-port=9200/tcp --permanent
sudo firewall-cmd --reload

If you want to allow access through another IP address, you can use the following commands:

sudo firewall-cmd --zone=elasticsearch --add-source=<IP_ADDRESS> --permanent
sudo firewall-cmd --reload

Save and exit the configuration file to apply the changes.

If you want to allow Elasticsearch to listen to external connections, you must open the Elasticsearch configuration file using the editor you want:

sudo nano /etc/elasticsearch/elasticsearch.yml

Then in the next step, you have to search for the line that contains Then uncomment it and change its value to

You may have multiple network interfaces on your device. In this case, you must specify the IP address of the interface to force Elasticsearch to listen only to the given interface. Finally, restart the system using the following command to apply the changes:

sudo systemctl restart elasticsearch


Elasticsearch is a powerful engine with high capabilities for data search and analysis. In this article, we first introduced Elasticsearch and then explained how to install and configure it step by step.

Rate this post
Share this Post

Leave a Reply

Your email address will not be published. Required fields are marked *