How to install Elasticsearch on Oracle Linux 9.3
To Install ElasticSearch On Oracle Linux 9.3
Introduction
Elasticsearch is a cost-effective, open-source, distributed search and analytics engine that is proficient in managing substantial quantities of data for real-time full-text searches in applications requiring comprehensive data analysis. Its popularity stems from its user-friendly interface, robust functionalities, and scalability. Elasticsearch facilitates data manipulation through a RESTful API with an HTTP URI. Its user-friendly features include automatic node recovery, enhanced security measures, scalability and resilience, automated data balancing, and additional capabilities.
Procedure Steps:
Step 1: Check the OS version by using the below command
[root@linuxhelp ~]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="9.3"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="9.3"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Oracle Linux Server 9.3"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:9:3:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://github.com/oracle/oracle-linux"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 9"
ORACLE_BUGZILLA_PRODUCT_VERSION=9.3
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=9.3
Step 2: Elastic Search is a Java-based application, so Java must be installed on your server. If not installed, you can install it using the below command
[root@linuxhelp ~]# dnf install java-11-openjdk-devel
Oracle Linux 9 BaseOS Latest (x86_64) 26 kB/s | 3.6 kB 00:00
Oracle Linux 9 BaseOS Latest (x86_64) 8.6 MB/s | 26 MB 00:03
Oracle Linux 9 Application Stream Packages (x86_64) 32 kB/s | 3.9 kB 00:00
Oracle Linux 9 Application Stream Packages (x86_64) 9.4 MB/s | 35 MB 00:03
Oracle Linux 9 UEK Release 7 (x86_64) 25 kB/s | 3.0 kB 00:00
Oracle Linux 9 UEK Release 7 (x86_64) 9.3 MB/s | 34 MB 00:03
Last metadata expiration check: 0:00:07 ago on Wednesday 05 June 2024 04:50:05 AM.
Dependencies resolved.
===========================================================================================================================================
Package Architecture Version Repository Size
===========================================================================================================================================
Installing:
java-11-openjdk-devel x86_64 1:11.0.23.0.9-3.0.1.el9 ol9_appstream 3.3 M
Installing dependencies:
copy-jdk-configs noarch 4.0-3.el9 ol9_appstream 28 k
java-11-openjdk x86_64 1:11.0.23.0.9-3.0.1.el9 ol9_appstream 442 k
java-11-openjdk-headless x86_64 1:11.0.23.0.9-3.0.1.el9 ol9_appstream 40 M
javapackages-filesystem noarch 6.0.0-4.el9 ol9_appstream 10 k
lksctp-tools x86_64 1.0.19-3.el9_4 ol9_baseos_latest 110 k
lua x86_64 5.4.4-4.el9 ol9_appstream 201 k
lua-posix x86_64 35.0-8.el9 ol9_appstream 174 k
ttmkfdir x86_64 3.0.9-65.el9 ol9_appstream 53 k
tzdata-java noarch 2024a-1.el9 ol9_appstream 522 k
xorg-x11-fonts-Type1 noarch 7.5-33.el9 ol9_appstream 526 k
Transaction Summary
===========================================================================================================================================
Install 11 Packages
Total download size: 45 M
Installed size: 187 M
Is this ok [y/N]: y
Downloading Packages:
(1/11): copy-jdk-configs-4.0-3.el9.noarch.rpm 124 kB/s | 28 kB 00:00
(2/11): lksctp-tools-1.0.19-3.el9_4.x86_64.rpm 394 kB/s | 110 kB 00:00
(3/11): java-11-openjdk-11.0.23.0.9-3.0.1.el9.x86_64.rpm 1.4 MB/s | 442 kB 00:00
(4/11): javapackages-filesystem-6.0.0-4.el9.noarch.rpm 413 kB/s | 10 kB 00:00
(5/11): lua-5.4.4-4.el9.x86_64.rpm 1.6 MB/s | 201 kB 00:00
(6/11): lua-posix-35.0-8.el9.x86_64.rpm 1.5 MB/s | 174 kB 00:00
(7/11): java-11-openjdk-devel-11.0.23.0.9-3.0.1.el9.x86_64.rpm 5.6 MB/s | 3.3 MB 00:00
(8/11): tzdata-java-2024a-1.el9.noarch.rpm 6.2 MB/s | 522 kB 00:00
(9/11): xorg-x11-fonts-Type1-7.5-33.el9.noarch.rpm 6.3 MB/s | 526 kB 00:00
(10/11): ttmkfdir-3.0.9-65.el9.x86_64.rpm 117 kB/s | 53 kB 00:00
(11/11): java-11-openjdk-headless-11.0.23.0.9-3.0.1.el9.x86_64.rpm 8.8 MB/s | 40 MB 00:04
-------------------------------------------------------------------------------------------------------------------------------------------
Total 9.4 MB/s | 45 MB 00:04
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Running scriptlet: copy-jdk-configs-4.0-3.el9.noarch 1/1
Running scriptlet: java-11-openjdk-headless-1:11.0.23.0.9-3.0.1.el9.x86_64 1/1
Preparing : 1/1
Installing : tzdata-java-2024a-1.el9.noarch 1/11
Installing : ttmkfdir-3.0.9-65.el9.x86_64 2/11
Installing : xorg-x11-fonts-Type1-7.5-33.el9.noarch 3/11
Running scriptlet: xorg-x11-fonts-Type1-7.5-33.el9.noarch 3/11
Installing : lua-posix-35.0-8.el9.x86_64 4/11
Installing : lua-5.4.4-4.el9.x86_64 5/11
Installing : copy-jdk-configs-4.0-3.el9.noarch 6/11
Installing : javapackages-filesystem-6.0.0-4.el9.noarch 7/11
Installing : lksctp-tools-1.0.19-3.el9_4.x86_64 8/11
Installing : java-11-openjdk-headless-1:11.0.23.0.9-3.0.1.el9.x86_64 9/11
Running scriptlet: java-11-openjdk-headless-1:11.0.23.0.9-3.0.1.el9.x86_64 9/11
Installing : java-11-openjdk-1:11.0.23.0.9-3.0.1.el9.x86_64 10/11
Running scriptlet: java-11-openjdk-1:11.0.23.0.9-3.0.1.el9.x86_64 10/11
Installing : java-11-openjdk-devel-1:11.0.23.0.9-3.0.1.el9.x86_64 11/11
Running scriptlet: java-11-openjdk-devel-1:11.0.23.0.9-3.0.1.el9.x86_64 11/11
Running scriptlet: copy-jdk-configs-4.0-3.el9.noarch 11/11
Running scriptlet: java-11-openjdk-headless-1:11.0.23.0.9-3.0.1.el9.x86_64 11/11
Running scriptlet: java-11-openjdk-1:11.0.23.0.9-3.0.1.el9.x86_64 11/11
Running scriptlet: java-11-openjdk-devel-1:11.0.23.0.9-3.0.1.el9.x86_64 11/11
Verifying : lksctp-tools-1.0.19-3.el9_4.x86_64 1/11
Verifying : copy-jdk-configs-4.0-3.el9.noarch 2/11
Verifying : java-11-openjdk-1:11.0.23.0.9-3.0.1.el9.x86_64 3/11
Verifying : java-11-openjdk-devel-1:11.0.23.0.9-3.0.1.el9.x86_64 4/11
Verifying : java-11-openjdk-headless-1:11.0.23.0.9-3.0.1.el9.x86_64 5/11
Verifying : javapackages-filesystem-6.0.0-4.el9.noarch 6/11
Verifying : lua-5.4.4-4.el9.x86_64 7/11
Verifying : lua-posix-35.0-8.el9.x86_64 8/11
Verifying : ttmkfdir-3.0.9-65.el9.x86_64 9/11
Verifying : tzdata-java-2024a-1.el9.noarch 10/11
Verifying : xorg-x11-fonts-Type1-7.5-33.el9.noarch 11/11
Installed:
copy-jdk-configs-4.0-3.el9.noarch java-11-openjdk-1:11.0.23.0.9-3.0.1.el9.x86_64
java-11-openjdk-devel-1:11.0.23.0.9-3.0.1.el9.x86_64 java-11-openjdk-headless-1:11.0.23.0.9-3.0.1.el9.x86_64
javapackages-filesystem-6.0.0-4.el9.noarch lksctp-tools-1.0.19-3.el9_4.x86_64
lua-5.4.4-4.el9.x86_64 lua-posix-35.0-8.el9.x86_64
ttmkfdir-3.0.9-65.el9.x86_64 tzdata-java-2024a-1.el9.noarch
xorg-x11-fonts-Type1-7.5-33.el9.noarch
Complete!
Step 3: After the installation, verify the Java version by using the below command
[root@linuxhelp ~]# java -version
openjdk version "11.0.23" 2024-04-16 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.23.0.9-3.0.1) (build 11.0.23+9-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.23.0.9-3.0.1) (build 11.0.23+9-LTS, mixed mode, sharing)
Step 4: By default, Elasticsearch is not included in the Oracle Linux default repository, so we will need to create a repository for it. For that first download and import the GPG key by using the below command
[root@linuxhelp ~]# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
Step 5: Create an Elasticsearch repo by using the below command
[root@linuxhelp ~]# vim /etc/yum.repos.d/elasticsearch.repo
Add those following Line
[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
Step 6: With the created repository file, we can now install Elasticsearch by using the below command
[root@linuxhelp ~]# dnf install elasticsearch
Elasticsearch repository for 7.x packages 9.6 MB/s | 61 MB 00:06
Last metadata expiration check: 0:00:27 ago on Wednesday 05 June 2024 04:52:22 AM.
Dependencies resolved.
===========================================================================================================================================
Package Architecture Version Repository Size
===========================================================================================================================================
Installing:
elasticsearch x86_64 7.17.21-1 elasticsearch-7.x 312 M
Transaction Summary
===========================================================================================================================================
Install 1 Package
Total download size: 312 M
Installed size: 520 M
Is this ok [y/N]: y
Downloading Packages:
elasticsearch-7.17.21-x86_64.rpm 10 MB/s | 312 MB 00:30
-------------------------------------------------------------------------------------------------------------------------------------------
Total 10 MB/s | 312 MB 00:30
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: elasticsearch-7.17.21-1.x86_64 1/1
Creating elasticsearch group... OK
Creating elasticsearch user... OK
Installing : elasticsearch-7.17.21-1.x86_64 1/1
Running scriptlet: elasticsearch-7.17.21-1.x86_64 1/1
### 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
Created elasticsearch keystore in /etc/elasticsearch/elasticsearch.keystore
/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.
Verifying : elasticsearch-7.17.21-1.x86_64 1/1
Installed:
elasticsearch-7.17.21-1.x86_64
Complete!
Step 7: After installing Elasticsearch, edit the Elasticsearch main configuration file by using the below command
[root@linuxhelp ~]# vim /etc/elasticsearch/elasticsearch.yml
Add those following Lines
cluster.name: Linuxhelp.com
node.name: node-1
network.host: 127.0.0.1
Step 8: Enable the Elasticsearch service by using the below command
[root@linuxhelp ~]# systemctl enable elasticsearch.service
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.
Step 9: Check the status of the Elasticsearch service by using the below command
[root@linuxhelp ~]# systemctl status elasticsearch.service
○ elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; preset: disabled)
Active: inactive (dead)
Docs: https://www.elastic.co
Step 10: Start the Elasticsearch service by using the below command
[root@linuxhelp ~]# systemctl start elasticsearch.service
Step 11: Again check the status Elasticsearch service by using the below command
[root@linuxhelp ~]# systemctl status elasticsearch.service
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; preset: disabled)
Active: active (running) since Wed 2024-06-05 04:56:14 IST; 13s ago
Docs: https://www.elastic.co
Main PID: 7675 (java)
Tasks: 81 (limit: 21739)
Memory: 2.0G
CPU: 1min 33.474s
CGroup: /system.slice/elasticsearch.service
├─7675 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative>
└─7865 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller
Jun 05 04:55:35 linuxhelp systemd[1]: Starting Elasticsearch...
Jun 05 04:55:43 linuxhelp systemd-entrypoint[7675]: Jun 05, 2024 4:55:43 AM sun.util.locale.provider.LocaleProviderAdapter <clinit>
Jun 05 04:55:43 linuxhelp systemd-entrypoint[7675]: WARNING: COMPAT locale provider will be removed in a future release
Jun 05 04:56:14 linuxhelp systemd[1]: Started Elasticsearch.
Step 12: Verify Elasticsearch by using the below command
[root@linuxhelp ~]# curl -X GET 'http://localhost:9200'
{
"name" : "node-1",
"cluster_name" : "Linuxhelp.com",
"cluster_uuid" : "umEWzl-QSCOpIWZX4daLhQ",
"version" : {
"number" : "7.17.21",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "d38e4b028f4a9784bb74de339ac1b877e2dbea6f",
"build_date" : "2024-04-26T04:36:26.745220156Z",
"build_snapshot" : false,
"lucene_version" : "8.11.3",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
With the above response, Elasticserach is working properly on port 9200
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to install Elasticsearch on Oracle Linux 9.3. Your feedback is much welcome.