Elasticsearch is a powerful open-source search and analytics engine that allows you to store, search, and analyze large volumes of data quickly and in near real time. In this article, we provide a comprehensive guide on installing Elasticsearch on CentOS/RHEL 9, a popular Linux distribution known for its stability and robustness. By following these steps, you can enhance the search capabilities of your applications and maximize data insights.

Advertisement

Prerequisites

Before beginning the installation, ensure you have:

  • A server running CentOS/RHEL 9.
  • Sudo privileges or access to the root user.
  • A stable internet connection.

Step 1: Update Your System

Open your terminal and update your system to the latest packages using the command:

sudo dnf update

Step 2: Installing Java

Elasticsearch is built using Java, so you need to install Java on your CentOS/RHEL system.

Install the OpenJDK package by running:

sudo dnf install java-11-openjdk

Verify the installation:

java -version

Step 3: Add Elasticsearch Repository

Elasticsearch packages are signed with a GPG key to ensure their integrity. You need to import this key:

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

Create a new repository file:

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

Add the following content to the file:


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

sudo dnf install –enablerepo=elasticsearch elasticsearch

Step 4: Installing Elasticsearch

Install Elasticsearch using the dnf package manager:

sudo dnf install --enablerepo=elasticsearch elasticsearch

Once the installation is complete, start and enable Elasticsearch to run on boot:

sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch

Step 5: Configure Elasticsearch (Optional)

You might want to configure Elasticsearch to suit your requirements. Edit the configuration file:

sudo nano /etc/elasticsearch/elasticsearch.yml

Here, you can set various parameters like cluster.name, node.name, and network settings.

Step 6: Test the Installation

To verify that Elasticsearch is running correctly, use the curl command to send an HTTP request:

curl -X GET "localhost:9200/"

You should see a response with the name, cluster name, Elasticsearch version, and more.

Step 7: Securing Elasticsearch

It’s essential to secure your Elasticsearch cluster. Some basic steps include:

  1. Setting up user authentication.
  2. Configuring HTTPS.
  3. Restricting access using firewalls.
  4. Refer to the official Elasticsearch documentation for advanced security configurations.

Conclusion

You have successfully installed Elasticsearch on your CentOS/RHEL 9 system. This setup provides a robust platform for developing powerful search and data analysis applications. Remember, maintaining and securing your Elasticsearch instance is crucial for effective and safe operations.

For more information and advanced configurations, refer to the Elasticsearch official documentation.

Happy searching!

Share.
Leave A Reply


Exit mobile version