Articles

How to Install Elasticsearch on CentOS 8

By Rabins Sharma Lamichhane

August 27, 2022

Install and use elasticsearch on centOS 8; Through this tutorial, we will learn how to install and use elasticsearch on centOS 8.

Elasticsearch is an open-source distributed full-text search and analytics engine. It supports RESTful operations and allows you to store, search, and analyze big volumes of data in real-time. Elasticsearch is one of the most popular search engines powering applications that have complex search requirements such as big e-commerce stores and analytic applications.

How to Install Elasticsearch on CentOS 8

Just follow the following steps to install and use elasticsearch on centOS 8:

Step 1 – Install Java

First of all, open terminal or command line and execute the following command into it to install java in centOS 8:

sudo dnf install java-11-openjdk-devel

Once the java installation is completed, execute the following command on terminal to verify java installation in centOS 8:

java -version

Step 2 – Import GPG Keys

Now, execute the following command on command line or terminal to import GPG key in centOS 8:

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

After that, Open text editor and create the repository file the /etc/yum.repos.d directory by executing the following command on command line or terminal:

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

Then paste the following content into the file:

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

Step 3 – Install Elasticsearch

Execute the following command on command line or terminal to install elasticsearch in centOS 8:

sudo dnf install elasticsearch

Step 4 – Configure Elasticsearch

Then edit Elasticsearch configuration file “/etc/elasticsearch/elasticsearch.yml” and set the network.host to localhost. we can also change it to the system LAP IP address to make it accessible over the network.

vim /etc/elasticsearch/elasticsearch.yml

Set the following values to customize your Elasticsearch environment.

cluster.name: Tutsmake-ES-Cluster node.name: node-1 path.data: /var/lib/elasticsearch network.host: 127.0.0.1

Step 5 – Start and Enable Service

Once the installation process is complete, start, and enable the service:

sudo systemctl enable elasticsearch.service --now

Step 6 – Test Elasticsearch

Once the Elasticsearch has been successfully installed and configure in CentOS 8 or RHEL 8 system. Now, We can use it for storing and searching content.

Execute the following command on command line or terminal to view the Elasticsearch server configuration and version details:

curl -X GET "localhost:9200/?pretty"

Conclusion

Install and use elasticsearch on centOS 8; Through this tutorial, we have learned how to install and use elasticsearch on centOS 8.

Images mentioned above related to CentOS are either copyright property of respective image owners.

Share this: