How to Install Elasticsearch on CentOS 7

Install Elasticsearch on Ubuntu 18.04

In this article, we will have explained the necessary steps to install and configure Elasticsearch on CentOS 7. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Elasticsearch is a flexible and powerful open source, distributed real-time search and analytics engine. With Elasticsearch, you can store, search, and analyze big volumes of data faster and in near real time. Elasticsearch is generally used as the underlying engine/technology that powers applications that have complex search features and requirements.

Install Elasticsearch on CentOS

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

Step 2. Install Java.

Java is the primary requirement for installing Elasticsearch. You can install Java by executing the following command:

Verify the Java installation by printing the Java version:

Step 3. Install Elasticsearch.

First, add the Elasticsearch repository:

Next, Open your text editor and create the following repo file:

You can install Elasticsearch using the command below:

Once the installation is done, you can start elasticsearch service by executing:

Step 4. Configure Elasticsearch.

You can customize this by editing the Elasticsearch configuration file. Edit configuration file in your favorite text editor and update the following values:

Change the following values:

Restart the Elasticsearch service for the changes to take effect:

Step 5. Test Elasticsearch Setup.

You can verify that Elasticsearch is running by sending an HTTP request to port 9200 on localhost with the following curl command:

You should see something similar to this:

Congratulation, you have learned how to install and configure Elasticsearch on CentOS 7. If you have any question, please leave a comment below.