‍Elasticsearch is an open-source full-text search and analytics engine tool that allows users to store, search, and analyze large volumes of data in near real-time. In this guide, we will walk you through the step-by-step process of installing Elasticsearch on AlmaLinux 8.

Prerequisites

Before installing Elasticsearch, you need to ensure that Java is installed on your system. Elasticsearch relies on Java, so it’s essential to have it set up. To install Java on AlmaLinux 8, use the following command:

dnf install java-11-openjdk-devel

Once the installation is complete, you can verify the Java installation by running the following command:

java-version

The output should display the version of Java installed on your system.

Installing Elasticsearch

To install Elasticsearch on AlmaLinux 8, you need to follow a few steps. First, import the GPG key for the Elasticsearch RPM packages by running the following command:

rpm --importhttps://artifacts.elastic.co/GPG-KEY-elasticsearch

Next, create a yum repository file for Elasticsearch using a text editor. For example, you can use nano to create the file:

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

In the repository file, add the following content:

[elasticsearch-7.x]
name=Elasticsearch repositoryfor7.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

Save the file and exit the text editor.

Once the repository is enabled, you can proceed to install Elasticsearch using the following command:

dnf install elasticsearch

After the installation is complete, the Elasticsearch package will be installed on your system.

Configuring Elasticsearch

After installing Elasticsearch, you need to configure it to suit your needs. To do this, you will need to edit the Elasticsearch configuration file located at “/etc/elasticsearch/elasticsearch.yml”. Use a text editor to open the file, for example:

vim /etc/elasticsearch/elasticsearch.yml

In the configuration file, you can modify various settings. For instance, you can set the cluster name, node name, path for data storage, and network host.

Here is an example configuration:

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

Make the necessary changes, save the file, and exit the text editor.

After configuring Elasticsearch, you can enable and start the Elasticsearch service using the following commands:

systemctl enable elasticsearch
systemctl start elasticsearch

To check the status of the Elasticsearch service, you can use the following command:

systemctl status elasticsearch

The output will indicate whether the service is active and running correctly.

Testing Elasticsearch

To ensure that Elasticsearch is installed and functioning correctly, you can run a simple test. Use the following command to view the Elasticsearch server configuration and version details:

curl -X GET "localhost:9200/"

If Elasticsearch is running properly, the output should display information about the cluster name, version, build details, and more.

Conclusion

In this guide, we have walked you through the process of installing Elasticsearch on AlmaLinux 8. By following the steps outlined above, you can set up Elasticsearch and begin utilizing its powerful search and analytics capabilities. Elasticsearch is a valuable tool for managing and analyzing large volumes of data, and it can significantly enhance your data exploration and search experiences.

Remember, if you’re looking for reliable and scalable cloud hosting solutions, Shape.host offers Cloud VPS services that can meet your needs. Shape.host provides secure and efficient hosting solutions, ensuring your applications and data are in safe hands.