Being a sysadmin is a complex task due to the large amount of information we have to handle. However, thanks to applications like Elasticsearch, we can find feasible solutions to huge problems. So, today, you will learn how to install Elasticsearch on Alma Linux 8.
According to the application’s website:
Elasticsearch is a free and open distributed analytics and analysis engine for all types of data, including textual, numeric, geospatial, structured and unstructured.
This allows us to introduce it into many applications where we have to do many simultaneous searches for anything, including logs or database query results.
Some things you can use Elasticsearch for are:
- Application search
- Website search
- Logging and log analytics
- Infrastructure metrics and container monitoring
- Application performance monitoring
So as you can see, Elasticsearch is vital for many companies that require fast responses to many requests.
Install Elasticsearch on Alma Linux 8
Installing Java on Alma Linux 8
One of the main dependencies of Elasticsearch is Java. That’s why we need to install it before continuing.
To do this, connect via SSH to your server and inside it, update it
sudo dnf update
Then, install Java by executing the following command
sudo dnf install java-11-openjdk-devel
After this, you can check which version of Java has been installed
openjdk 11.0.15 2022-04-19 LTS OpenJDK Runtime Environment 18.9 (build 11.0.15+9-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.15+9-LTS, mixed mode, sharing)
This is enough.
Adding the external repository and installing Elasticsearch on Alma Linux 8
The best way to get Elasticsearch is to install it by using a repository provided by the developers of the tool.
First, add the GPG key of the repository so that the system can use it correctly
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
Next, create a file containing the repository information
sudo vi /etc/yum.repos.d/elasticsearch.repo
Then add the following content
[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
Save the changes and close the editor.
Next, install Elasticsearch with the following command
sudo dnf install elasticsearch
This will install it.
After it is installed, you have to start it and enable it at once so that it can run at system startup
sudo systemctl enable elasticsearch.service --now
Synchronizing state of elasticsearch.service with SysV service script with /usr/lib/systemd/systemd-sysv-install. Executing: /usr/lib/systemd/systemd-sysv-install enable elasticsearch Created symlink /etc/systemd/system/multi-user.target.wants/elasticsearch.service → /usr/lib/systemd/system/elasticsearch.service.
You can then check the status of the service
sudo systemctl status elasticsearch
So, Elasticsearch is running correctly. Now let’s give it a bit of a hand.
To do this, we need to edit the
/etc/elasticsearch/elasticsearch.yml file, which is where all the configuration of the tool resides.
Let’s edit it
sudo vi /etc/elasticsearch/elasticsearch.yml
And we can, for example, enable remote access, although this is optional. To do so, edit the
network.host directive and set the IP address of the server.
Or you can make it listen for all requests from any host
By default, Elasticsearch works on port
9200 but we can change that too. You can do this from the
Remember that port has to be available in the firewall.
Close the file after saving the changes. To apply them, you have to restart the service.
sudo systemctl restart elasticsearch
In this post, you learned the basics of Elasticsearch, as well as how to install it from scratch on a system such as Alma Linux 8.
I hope you liked the post and help us to share it.