How To Install Elasticsearch 8.15 On CentOS Stream 9

How To Install Elasticsearch 8.15 On CentOS Stream 9

In today’s data-driven world, the ability to search, analyze, and visualize vast amounts of data in real-time is critical for businesses. Elasticsearch, a powerful open-source search and analytics engine, is designed to fulfill these needs. In this article, we will explore what Elasticsearch is, how it works, and why it has become a go-to solution for organizations around the globe.

Elasticsearch is a distributed, RESTful search and analytics engine built on top of Apache Lucene. It is designed to handle large volumes of data and enables quick searches, data analysis, and real-time insights. Originally released in 2010, Elasticsearch has grown to be a core component in the Elastic Stack (formerly known as ELK Stack), which includes Logstash, Kibana, and Beats.

Installing Elasticsearch 8.15 on CentOS Stream 9

On this article we will learn how to install Elasticsearch 8.15 on CentOS Stream 9. Elasticsearch can be installed on various operating systems, including Linux, Windows, and macOS. The installation process typically involves downloading the package, configuring Elasticsearch, and starting the service. It can also be deployed using Docker or through managed services like Elastic Cloud.

The examples in this guide, we will use RPM packages to install the Elastic Stack components on hosts running CentOS Stream 9 opearting system. RPM Package Manager (originally “Red Hat Package Manager”), is a powerful package management system used in many Linux distributions, including Red Hat Enterprise Linux (RHEL), CentOS, Fedora, and others. It is the default package management tool for these distributions and is used to install, update, uninstall, and manage software packages. To install Elasticsearch on CentOS, follow these steps:

  • Step 1: Set up the Elasticsearch node
  • Step 2: Configure the Elasticsearch node for connectivity
  • Step 3: Start Elasticsearch

Set up The Elasticsearch node

On this scenario, we will use one node. This initial Elasticsearch instance will serve as the master node. To setup the Elastic node we will do following command line :

  • Create new directory and change into the new directory
  • Download the Elasticsearch RPM and checksum file from the Elastic Artifact Registry.
  • Confirm the validity of the downloaded package by checking the SHA of the downloaded RPM against the published checksum
  • Run the Elasticsearch install command

1. Create New Directory For Elasticsearcg RPM Package file

The first step to install Elasticsearch using RPM method is by downloading Elasticsearch RPM package from its official web site.

Create a  working directory for the installation package, on this example we will name it as elastic_files.

$ mkdir elastic_files
$ cd elastic_files

2.Download Elasticsearch Packages file

On this tutorial, we will be using Elasticsearch version 8.15.  By using wget command line, we will download the file with SHA checking file.

$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.15.0-x86_64.rpm
$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.15.0-x86_64.rpm.sha512
$ shasum -a 512 -c elasticsearch-8.15.0-x86_64.rpm.sha512

Output :

[ramansah@dev03 elastic_files]$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.15.0-x86_64.rpm
--2024-08-17 22:20:32-- https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.15.0-x86_64.rpm
Resolving artifacts.elastic.co (artifacts.elastic.co)... 34.120.127.130, 2600:1901:0:1d7::
Connecting to artifacts.elastic.co (artifacts.elastic.co)|34.120.127.130|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 606146980 (578M) [application/x-redhat-package-manager]
Saving to: ‘elasticsearch-8.15.0-x86_64.rpm’

elasticsearch-8.15.0-x86_64.rp 100%[===================================================>] 578.07M 3.33MB/s in 2m 55s

2024-08-17 22:23:29 (3.29 MB/s) - ‘elasticsearch-8.15.0-x86_64.rpm’ saved [606146980/606146980]


[ramansah@dev03 elastic_files]$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.15.0-x86_64.rpm.sha512 
--2024-08-17 22:28:12-- https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.15.0-x86_64.rpm.sha512
Resolving artifacts.elastic.co (artifacts.elastic.co)... 34.120.127.130, 2600:1901:0:1d7:: 
Connecting to artifacts.elastic.co (artifacts.elastic.co)|34.120.127.130|:443... connected. 
HTTP request sent, awaiting response... 200 OK 
Length: 162 [binary/octet-stream] Saving to: ‘elasticsearch-8.15.0-x86_64.rpm.sha512’ 
elasticsearch-8.15.0-x86_64.rp 100%[===================================================>] 162 --.-KB/s in 0s 
2024-08-17 22:28:14 (1.14 MB/s) - ‘elasticsearch-8.15.0-x86_64.rpm.sha512’ saved [162/162]

3. Validate the Package file

Then we will validate the downloaded package by checking the SHA of the downloaded RPM against the published checksum, by submitting command line :

[ramansah@dev03 elastic_files]$ shasum -a 512 -c elasticsearch-8.15.0-x86_64.rpm.sha512
elasticsearch-8.15.0-x86_64.rpm: OK

On this stage we have validated source of Elasticsearch version 8.15.

4. Install The Elasticsearch 8.15 on CentOS Stream 9

In this step, we will install Elasticsearch 8.15 on CentOS Stream 9 operating system, for this purpose we will submit following command line :

$ sudo rpm --install elasticsearch-8.15.0-x86_64.rpm

Output will be as shown below :

ramansah@dev03 elastic_files]$ sudo rpm --install elasticsearch-8.15.0-x86_64.rpm
[sudo] password for ramansah: 
warning: elasticsearch-8.15.0-x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID d88e42b4: NOKEY
Creating elasticsearch group... OK
Creating elasticsearch user... OK
--------------------------- Security autoconfiguration information ------------------------------

Authentication and authorization are enabled.
TLS for the transport and HTTP layers is enabled and configured.

The generated password for the elastic built-in superuser is : d9ZDso6BgChcvd2Ezx1U

If this node should join an existing cluster, you can reconfigure this with
'/usr/share/elasticsearch/bin/elasticsearch-reconfigure-node --enrollment-token <token-here>'
after creating an enrollment token on your existing cluster.

You can complete the following actions at any time:

Reset the password of the elastic built-in superuser with 
'/usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic'.

Generate an enrollment token for Kibana instances with 
'/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana'.

Generate an enrollment token for Elasticsearch nodes with 
'/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s node'.

-------------------------------------------------------------------------------------------------
### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service
### You can start elasticsearch service by executing
sudo systemctl start elasticsearch.service
/usr/lib/tmpfiles.d/elasticsearch.conf:1: Line references path below legacy directory /var/run/, updating /var/run/elasticsearch → /run/elasticsearch; please update the tmpfiles.d/ drop-in file accordingly.

After installation was completed done, then we will reload its services and enable Elasticsearch to start automatically when the host system reboots.

[ramansah@dev03 elastic_files]$ sudo systemctl daemon-reload
[ramansah@dev03 elastic_files]$ sudo systemctl enable elasticsearch.service
Created symlink /etc/systemd/system/multi-user.target.wants/elasticsearch.service → /usr/lib/systemd/system/elasticsearch.service.

Configuring Elasticsearch Node Connectivity

On this step we will update the Elasticsearch configuration to accommodate that other hosts are able to connect to it. For this purpose we will update the configuration settings in the elasticsearch.yml file.  There are about three parameters which will be udpate, namely :

  1. cluster.name
  2. network.host
  3. transport.host: 0.0.0.0

The Elasticsearch configuration file is located at /etc/elasticsearch/elasticsearch.yml file. By using text editor we will update the file, and update the three paramteres above as suitable as our environment.

1. cluster name

For this tutorial, we will change the clustername as bckinfoelastic.

ramansah@dev03 elastic_files]$ sudo vim /etc/elasticsearch/elasticsearch.yml

---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: bckinfoelastic
#

2. Network.host

Elasticsearch instance will be running on a routable, external IP address. Thus we need to define the netwrok host IP Address for this purpose.

# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 192.168.163.132

3. Transport.host

The transport.host: 0.0.0.0. The 0.0.0.0 setting enables Elasticsearch to listen for connections on all available network interfaces. Note that in a production environment you might want to restrict this by setting this value to match the value set for network.host.

# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
#http.port: 9200
# Allow other nodes to join the cluster from anywhere
# Connections are encrypted and mutually authenticated
transport.host: 0.0.0.0

Start Elasticsearch

1. Starting Elasticsearch

On this stage, we will start up the Elasticsearch 8.15 service. For this purpose we will submit the following command line :

$ sudo systemctl start elasticsearch.service
$ sudo systemctl status elasticsearch.service

Output :

ramansah@dev03 elastic_files]$ sudo systemctl start elasticsearch.service
[ramansah@dev03 elastic_files]$ sudo systemctl status elasticsearch.service
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; preset: disabled)
Active: active (running) since Sat 2024-08-17 22:45:20 WIB; 10s ago
Docs: https://www.elastic.co
Main PID: 35220 (java)
Tasks: 89 (limit: 22826)
Memory: 2.3G
CPU: 1min 49.870s
CGroup: /system.slice/elasticsearch.service
├─35220 /usr/share/elasticsearch/jdk/bin/java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=/usr/sha>
├─35279 /usr/share/elasticsearch/jdk/bin/java -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl>
└─35299 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller

Aug 17 22:44:25 dev03.bckinfo systemd[1]: Starting Elasticsearch...
Aug 17 22:44:34 dev03.bckinfo systemd-entrypoint[35220]: Aug 17, 2024 10:44:34 PM sun.util.locale.provider.LocaleProviderAdapter <>
Aug 17 22:44:34 dev03.bckinfo systemd-entrypoint[35220]: WARNING: COMPAT locale provider will be removed in a future release
Aug 17 22:45:20 dev03.bckinfo systemd[1]: Started Elasticsearch.

2. Verify Elasticsearch

On this stage we will verify if the Elasticsearch which was installed on the system is running properly. We will do following command line.

$ sudo curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic:d9ZDso6BgChcvd2Ezx1U https://localhost:9200

Output :

ramansah@dev03 elastic_files]$ sudo curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic:d9ZDso6BgChcvd2Ezx1U https://localhost:9200
{
"name" : "dev03.bckinfo",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "Wl5j5b4VQHq0o_ilyKe9qA",
"version" : {
"number" : "8.15.0",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "1a77947f34deddb41af25e6f0ddb8e830159c179",
"build_date" : "2024-08-05T10:05:34.233336849Z",
"build_snapshot" : false,
"lucene_version" : "9.11.1",
"minimum_wire_compatibility_version" : "7.17.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "You Know, for Search"
}
We can also verify using a browser by typing the URL https://ip_address_or_hostname:9200, on this tutorial, we have dev03.bckinfo as our hostname. The result is as shown below.



The result is as shown above.

 

Conclusion

The Elasticsearch version 8.15 installation on CentOS Stream 9 has been done successfully. More information about Elasticsearch can be found on Elasticsearch official website.

 

 

 

 

 

(Visited 22 times, 1 visits today)

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *