To install Elasticsearch on AlmaLinux, you can follow these steps. Elasticsearch is not available in the default AlmaLinux repositories, so you’ll need to add the Elasticsearch repository and then install it using the package manager, such as DNF.
Here are the steps:
01 –Install OpenJDK:
Elasticsearch requires Java to run. You can install OpenJDK, which is an open-source implementation of the Java Platformsudo dnf install java-11-openjdk-devel
02 –Import Elasticsearch GPG Key:
To ensure package integrity, import the Elasticsearch GPG key.sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
03 –Add Elasticsearch Repository:
Create a new repository configuration file for Elasticsearch in the /etc/yum.repos.d/
directory. You can use a text editor like nano
or vim
to create the file.sudo nano /etc/yum.repos.d/elasticsearch.repo
- Add the following repository configuration to the file:
[elasticsearch] 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
Save the file and exit the text editor.
04 –Install Elasticsearch:
Now, you can install Elasticsearch using the following command:sudo dnf install elasticsearch
Enable the Elasticsearch service to start automatically on boot and start it for the current session:
05 –Enable and Start Elasticsearch Service:sudo systemctl enable elasticsearch sudo systemctl start elasticsearch
(Optional):By default, Elasticsearch should be up and running. However, you may want to configure it according to your needs. The configuration files for Elasticsearch are located in the
06 –Configure Elasticsearch/etc/elasticsearch/
directory.
07 –Test Elasticsearch:
To test that Elasticsearch is running, you can use the following command to check its status:sudo systemctl status elasticsearch
You can also use curl to query Elasticsearch’s REST API. For example:curl -X GET "http://localhost:9200/"
This should return information about your Elasticsearch instance.
That’s it! Elasticsearch is now installed and running on your AlmaLinux server. You can configure and use it for various search and analytics purposes.