Learn how to install OpenSearch on Rocky Linux 9 with our comprehensive guide. Discover the step-by-step process to set up this powerful open-source search and analytics engine, empowering your data exploration and analysis. #centlinux #linux #opensearch
Table of Contents
What is OpenSearch?
OpenSearch is a collection of technologies that allow for the integration of search functionality into web-based applications. It was created by Amazon in 2005 and has since become an open standard with contributions from various organizations. OpenSearch provides a standard format for representing search results, as well as a protocol for requesting and receiving search results.
OpenSearch is commonly used in web browsers and search engines, where it allows users to add custom search engines to their browser’s search bar. OpenSearch is also used in enterprise search systems, content management systems, and other applications where search functionality is important.
In addition to the OpenSearch format and protocol, there are also several related technologies that have been developed, including OpenSearch Description documents, which provide information about the search engine’s capabilities and behavior, and OpenSearch Query Syntax, which defines a standard syntax for search queries.
Elasticsearch vs Opensearch
Elasticsearch and OpenSearch are both powerful search and analytics engines, but they have some key differences:
- Ownership and Governance:
- Elasticsearch: Elasticsearch was originally developed by Elastic NV (now known as Elastic), a company that provides commercial products and services around Elasticsearch. While Elasticsearch itself is open-source, some features and functionalities are proprietary to Elastic’s commercial offerings.
- OpenSearch: OpenSearch is a community-driven, open-source project forked from Elasticsearch and Kibana. It was created as a response to changes in the licensing model of Elasticsearch by Elastic. OpenSearch is governed by the OpenSearch community and offers a fully open-source alternative to Elasticsearch.
- Licensing:
- Elasticsearch: Elasticsearch was originally released under the Apache 2.0 license. However, Elastic introduced a dual licensing model with the introduction of the Elastic License and the Server Side Public License (SSPL) for certain features, which led to concerns in the open-source community.
- OpenSearch: OpenSearch is released under the Apache 2.0 license, ensuring that it remains fully open-source and freely available for use, modification, and distribution by anyone.
- Community Involvement:
- Elasticsearch: While Elasticsearch has a large and active community of users and contributors, the primary development and direction of the project are driven by Elastic.
- OpenSearch: OpenSearch is developed and maintained by a diverse community of contributors, including individuals, companies, and organizations. The project aims to foster a collaborative and transparent development process with input from the community.
- Features and Compatibility:
- Elasticsearch: Elasticsearch offers a wide range of features for search, analytics, and data visualization. It has a mature ecosystem with support for various integrations and plugins.
- OpenSearch: OpenSearch inherits many features from Elasticsearch but also introduces new enhancements and improvements. It strives to maintain compatibility with Elasticsearch APIs and plugins while also introducing new features developed by the community.
In summary, Elasticsearch and OpenSearch share a common heritage but diverge in terms of ownership, licensing, community involvement, and features. The choice between them often depends on factors such as licensing preferences, community involvement, and specific feature requirements.
Environment Specification
We are using a minimal Rocky Linux 9 virtual machine with following specifications.
- CPU – 3.4 Ghz (2 cores)
- Memory – 4 GB
- Storage – 20 GB
- Operating System – Rocky Linux release 9.1 (Blue Onyx)
- Hostname – opensearch-01.centlinux.com
- IP Address – 192.168.116.128/24
Prepare your Linux Server
Connect with your Linux server as root user, by using a ssh client.
Set a hostname and configure Local DNS Resolution for your Linux machine.
# hostnamectl set-hostname opensearch-01.centlinux.com # echo "192.168.116.128 opensearch-01 opensearch-01.centlinux.com" >> /etc/hosts
Execute dnf command to update your Linux operating system.
# dnf update -y
Reboot your operating system, if the above command updates your Linux Kernel.
# reboot
Note down the Linux operating system and Kernel versions, that are being used in this tutorial.
# cat /etc/rocky-release Rocky Linux release 9.1 (Blue Onyx) # uname -r 5.14.0-162.23.1.el9_1.x86_64
To improve the performance of OpenSearch software, you need to disable the Linux swap memory.
Execute the following Linux commands to permanently disable swap memory.
# sed -i '/ swap / s/^(.*)$/#1/g' /etc/fstab # swapoff -a
Check the status of swap memory.
# free -m total used free shared buff/cache available Mem: 3627 508 3089 8 254 3118 Swap: 0 0 0
Increase the value of Linux Kernel parameter: max_map_count
max_map_count is a Linux kernel parameter that defines the maximum count of mapped memory regions allowed in the system.
Check the current value of max_map_count parameter.
# sysctl -a | grep max_map_count vm.max_map_count = 65530
Execute following commands at Linux terminal to set max_map_count parameter and then reload the Linux Kernel parameters.
# echo "vm.max_map_count=262144" >> /etc/sysctl.d/99-vm.conf # sysctl --system
Now, check the current value of max_map_count parameter again.
# sysctl -a | grep max_map_count vm.max_map_count = 262144
You will need wget command to download files from Internet. Therefore, install it now.
# dnf install -y wget
How to install OpenSearch on Linux
OpenSearch software is available to download from their official website and through official yum repository.
Here, we are planning to install OpenSearch on Linux via yum repository.
Therefore, download and install OpenSearch yum repository by using wget command.
# wget https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/opensearch-2.x.repo -P /etc/yum.repos.d/ --2023-04-20 19:45:42-- https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/opensearch-2.x.repo Resolving artifacts.opensearch.org (artifacts.opensearch.org)... 18.64.141.2, 18.64.141.54, 18.64.141.78, ... Connecting to artifacts.opensearch.org (artifacts.opensearch.org)|18.64.141.2|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 242 [binary/octet-stream] Saving to: ‘/etc/yum.repos.d/opensearch-2.x.repo’ opensearch-2.x.repo 100%[===================>] 242 --.-KB/s in 0s 2023-04-20 19:45:44 (1.66 MB/s) - ‘/etc/yum.repos.d/opensearch-2.x.repo’ saved [242/242]
Refresh yum cache by using dnf command.
# dnf makecache OpenSearch 2.x 328 B/s | 498 B 00:01 OpenSearch 2.x 6.9 kB/s | 3.1 kB 00:00 Importing GPG key 0x9310D3FC: Userid : "OpenSearch project <opensearch@amazon.com>" Fingerprint: C5B7 4989 65EF D1C2 924B A9D5 39D3 1987 9310 D3FC From : https://artifacts.opensearch.org/publickeys/opensearch.pgp Is this ok [y/N]: y OpenSearch 2.x 92 kB/s | 171 kB 00:01 Rocky Linux 9 - BaseOS 1.0 kB/s | 4.1 kB 00:03 Rocky Linux 9 - AppStream 2.0 kB/s | 4.5 kB 00:02 Rocky Linux 9 - Extras 578 B/s | 2.9 kB 00:05 Metadata cache created.
Get information about opensearch software packages.
# dnf info opensearch Last metadata expiration check: 0:00:24 ago on Thu 20 Apr 2023 07:46:24 PM PKT. Available Packages Name : opensearch Version : 2.6.0 Release : 1 Architecture : aarch64 Size : 672 M Source : opensearch-2.6.0-1.src.rpm Repository : opensearch-2.x Summary : An open source distributed and RESTful search engine URL : https://opensearch.org/ License : Apache-2.0 Description : OpenSearch makes it easy to ingest, search, visualize, and : analyze your data For more information, see: : https://opensearch.org/ Name : opensearch Version : 2.6.0 Release : 1 Architecture : x86_64 Size : 675 M Source : opensearch-2.6.0-1.src.rpm Repository : opensearch-2.x Summary : An open source distributed and RESTful search engine URL : https://opensearch.org/ License : Apache-2.0 Description : OpenSearch makes it easy to ingest, search, visualize, and : analyze your data For more information, see: : https://opensearch.org/
You can see that, there are two packages of opensearch software i.e. one for x86 (32-bit) and other for x64 (64-bit) platforms.
Open Search GPG Key uses SHA1 hashing algorithm.
But, SHA1 has been deprecated in Red Hat Enterprise Linux 9 and RHEL 9 forks in favor of more secure hashing algorithms.
So, you will encounter some error messages, when trying to install OpenSearch on Linux 9.
Although, the default policy does not accept SHA1, but you can still workaround this issue by temporarily enabling the SHA1 support and after installing OpenSearch you can revert back to default hashing algorithm.
# update-crypto-policies --set DEFAULT:SHA1 # dnf install -y opensearch # update-crypto-policies --set DEFAULT
Enable and start OpenSearch service.
# systemctl enable --now opensearch Created symlink /etc/systemd/system/multi-user.target.wants/opensearch.service → /usr/lib/systemd/system/opensearch.service.
Check the status of OpenSearch service for any possible issues.
# systemctl status opensearch
● opensearch.service - OpenSearch
Loaded: loaded (/usr/lib/systemd/system/opensearch.service; enabled; vendo>
Active: active (running) since Fri 2023-04-21 17:03:49 PKT; 40s ago
Docs: https://opensearch.org/
Main PID: 4952 (java)
Tasks: 70 (limit: 22962)
Memory: 1.2G
CPU: 1min 51.298s
CGroup: /system.slice/opensearch.service
└─4952 /usr/share/opensearch/jdk/bin/java -Xshare:auto -Dopensearc>
Apr 21 17:02:56 opensearch-01.centlinux.com systemd[1]: Starting OpenSearch...
Apr 21 17:03:10 opensearch-01.centlinux.com systemd-entrypoint[4952]: WARNING: >
Apr 21 17:03:10 opensearch-01.centlinux.com systemd-entrypoint[4952]: WARNING: >
Apr 21 17:03:49 opensearch-01.centlinux.com systemd[1]: Started OpenSearch.
OpenSearch service is running fine.
Now, edit OpenSearch configuration file by using vim text editor.
# vi /etc/opensearch/opensearch.yml
Locate and set following directives in this file.
network.host: 192.168.116.128 discovery.type: single-node plugins.security.disabled: false
Edit JVM (Java Virtual Machine) options by using vim text editor.
# vi /etc/opensearch/jvm.options
Find and set following directives therein.
-Xms2g -Xmx2g
Restart OpenSearch service to load new configurations.
# systemctl restart opensearch
OpenSearch service runs at default port 9200/tcp. Therefore, you need to allow it in your Linux Firewall to make your service accessible across the network.
# firewall-cmd --permanent --add-port=9200/tcp success # firewall-cmd --reload success
Verify OpenSearch service by sending request to the server to confirm that OpenSearch is running. Note the use of –insecure flag, which is required because the TLS certificates are self-signed.
# curl -X GET https://opensearch-01:9200 -u 'admin:admin' --insecure
{
"name" : "opensearch-01.centlinux.com",
"cluster_name" : "opensearch",
"cluster_uuid" : "xUAVHO7mQ5KBsdXnuXEi6w",
"version" : {
"distribution" : "opensearch",
"number" : "2.6.0",
"build_type" : "rpm",
"build_hash" : "7203a5af21a8a009aece1474446b437a3c674db6",
"build_date" : "2023-02-24T18:57:09.290618503Z",
"build_snapshot" : false,
"lucene_version" : "9.5.0",
"minimum_wire_compatibility_version" : "7.10.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "The OpenSearch Project: https://opensearch.org/"
}
Similarly, query the plugins endpoint.
# curl -X GET https://opensearch-01:9200/_cat/plugins?v -u 'admin:admin' --insecure name component version opensearch-01.centlinux.com opensearch-alerting 2.6.0.0 opensearch-01.centlinux.com opensearch-anomaly-detection 2.6.0.0 opensearch-01.centlinux.com opensearch-asynchronous-search 2.6.0.0 opensearch-01.centlinux.com opensearch-cross-cluster-replication 2.6.0.0 opensearch-01.centlinux.com opensearch-geospatial 2.6.0.0 opensearch-01.centlinux.com opensearch-index-management 2.6.0.0 opensearch-01.centlinux.com opensearch-job-scheduler 2.6.0.0 opensearch-01.centlinux.com opensearch-knn 2.6.0.0 opensearch-01.centlinux.com opensearch-ml 2.6.0.0 opensearch-01.centlinux.com opensearch-neural-search 2.6.0.0 opensearch-01.centlinux.com opensearch-notifications 2.6.0.0 opensearch-01.centlinux.com opensearch-notifications-core 2.6.0.0 opensearch-01.centlinux.com opensearch-observability 2.6.0.0 opensearch-01.centlinux.com opensearch-performance-analyzer 2.6.0.0 opensearch-01.centlinux.com opensearch-reports-scheduler 2.6.0.0 opensearch-01.centlinux.com opensearch-security 2.6.0.0 opensearch-01.centlinux.com opensearch-security-analytics 2.6.0.0 opensearch-01.centlinux.com opensearch-sql
Install OpenSearch Dashboards
OpenSearch Dashboards is the default visualization tool for data in OpenSearch. It also serves as a user interface for many of the OpenSearch plugins, including security, alerting, Index State Management, SQL, and more.
OpenSearch Dashboards software is available via official yum repository. You can download and install this yum repository by executing following command at Linux terminal.
# wget https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/2.x/opensearch-dashboards-2.x.repo -P /etc/yum.repos.d/
Build cache for newly installed yum repositories.
# dnf makecache OpenSearch 2.x 337 B/s | 498 B 00:01 OpenSearch Dashboards 2.x 354 B/s | 498 B 00:01 OpenSearch Dashboards 2.x 3.6 kB/s | 3.1 kB 00:00 Importing GPG key 0x9310D3FC: Userid : "OpenSearch project <opensearch@amazon.com>" Fingerprint: C5B7 4989 65EF D1C2 924B A9D5 39D3 1987 9310 D3FC From : https://artifacts.opensearch.org/publickeys/opensearch.pgp Is this ok [y/N]: y OpenSearch Dashboards 2.x 941 kB/s | 9.7 MB 00:10 Rocky Linux 9 - BaseOS 471 B/s | 4.1 kB 00:08 Rocky Linux 9 - AppStream 1.2 kB/s | 4.5 kB 00:03 Rocky Linux 9 - Extras 1.2 kB/s | 2.9 kB 00:02 Metadata cache created.
Install OpenSearch Dashboards by using dnf command. You will encounter the SHA1 algorithm error again. But you can workaround this error by setting default policy to SHA1 and then revert it back after installation.
# update-crypto-policies --set DEFAULT:SHA1 # dnf install -y opensearch-dashboards # update-crypto-policies --set DEFAULT
Enable and start OpenSearch Dashboards service.
# systemctl enable --now opensearch-dashboards Created symlink /etc/systemd/system/multi-user.target.wants/opensearch-dashboards.service → /usr/lib/systemd/system/opensearch-dashboards.service.
Verify the status of OpenSearch Dashboards service.
# systemctl status opensearch-dashboards ● opensearch-dashboards.service - "OpenSearch Dashboards" Loaded: loaded (/usr/lib/systemd/system/opensearch-dashboards.service; ena> Active: active (running) since Fri 2023-04-21 18:08:39 PKT; 3min 13s ago Main PID: 6344 (node) Tasks: 11 (limit: 22962) Memory: 163.4M CPU: 18.091s CGroup: /system.slice/opensearch-dashboards.service └─6344 /usr/share/opensearch-dashboards/bin/../node/bin/node /usr/> Apr 21 18:11:31 opensearch-01.centlinux.com opensearch-dashboards[6344]: {"type> Apr 21 18:11:33 opensearch-01.centlinux.com opensearch-dashboards[6344]: {"type> Apr 21 18:11:36 opensearch-01.centlinux.com opensearch-dashboards[6344]: {"type>
Edit OpenSearch Dashboards configuration file with the help of vim text editor.
# vi /etc/opensearch-dashboards/opensearch_dashboards.yml
Locate and set following directives in this file.
server.host: 192.168.116.128 opensearch.hosts: [https://192.168.116.128:9200] opensearch.ssl.verificationMode: none opensearch.username: kibanaserver opensearch.password: kibanaserver
Restart OpenSearch Dashboards service to load configuration changes.
# systemctl restart opensearch-dashboards
Check the status of OpenSearch Dashboards service for any possible errors.
# systemctl status opensearch-dashboards ● opensearch-dashboards.service - "OpenSearch Dashboards" Loaded: loaded (/usr/lib/systemd/system/opensearch-dashboards.service; ena> Active: active (running) since Fri 2023-04-21 19:11:00 PKT; 1min 37s ago Main PID: 6896 (node) Tasks: 11 (limit: 22962) Memory: 159.6M CPU: 16.430s CGroup: /system.slice/opensearch-dashboards.service └─6896 /usr/share/opensearch-dashboards/bin/../node/bin/node /usr/> Apr 21 19:11:09 opensearch-01.com opensearch-dashboards[6896]: {"type> Apr 21 19:11:10 opensearch-01.com opensearch-dashboards[6896]: {"type> Apr 21 19:11:11 opensearch-01.com opensearch-dashboards[6896]: {"type>
Allow OpenSearch Dashboards Default Port 5601/tcp in Linux firewall.
# firewall-cmd --add-port=5601/tcp --permanent success # firewall-cmd --reload success
Access OpenSearch Dashboards
Open URL http://opensearch-01.centlinux.com:5601 in a web browser.
Login with default credentials i.e. kibanaserver/kibanaserver
You have reached at the Home page of OpenSearch Dashboard.
Final Thoughts
Embracing how to install OpenSearch on Rocky Linux 9, unleashes a world of possibilities for data exploration and analysis. With our detailed guide, navigating the setup process becomes seamless, empowering you to harness the full potential of this robust open-source search and analytics engine. If you are new to Linux commandline, then we recommend that you should attend online training: Linux Administration: The Complete Linux Training Course