How To Install OpenSearch on Ubuntu 20.04
OpenSearch is an analytics engine built using Apache Lucene with distributed search. It’s easy to perform full-text searches on data stored in OpenSearch and enjoy all the features available in alternative solutions like Elasticsearch. This project was originally created by Amazon as a fork of Elasticsearch. The main difference between the two is that OpenSearch focuses on open, community-driven, and transparent development. OpenSearch is known to deliver outstanding performance with the ability to scale up and down according to the needs and requirements of your application workloads.
Another example of an OpenSearch use case is log analysis. Your application can provide logs to OpenSearch, and you use its rich search and visualization functions to understand problems in your application, such as error rates. OpenSearch dashboards are used to build all types of data visualizations in OpenSearch that suit your application and monitoring requirements.
Installing OpenSearch on Ubuntu 22.04|20.04|18.04 is not a difficult process as the Developer maintains a working APT repository with the latest packages. Building OpenSearch from source is another installation method, but what is the real need for this? Installing using apt
from Deb repository is the recommended method.
Add OpenSearch APT repository
OpenSearch and OpenSearch console are compatible with all recent LTS releases of Ubuntu Linux. You should avoid using a network file system to store data that OpenSearch uses, especially for production workflows.
Log in to your Ubuntu system and make sure it is up to date:
apt update && apt upgrade -y
If you have a file, /var/run/reboot-required
that means it needs a reboot.
[ -e /var/run/reboot-required ] && reboot
Install some dependent packages before adding the repository.
apt -y install curl lsb-release gnupg2 ca-certificates
Enter the public GPG key for the APT repository to be added.
curl -fsSL https://artifacts.opensearch.org/publickeys/opensearch.pgp|gpg --dearmor -o /etc/apt/trusted.gpg.d/opensearch.gpg
Next, we add the APT repository for OpenSearch:
echo "deb https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/apt stable main" | tee /etc/apt/sources.list.d/opensearch-2.x.list
Verify if our repository is working.
apt update
Install and configure OpenSearch
To list all OpenSearch versions available in the repository we added, run the commands below.
$ apt list -a opensearch
Unless you need a specific version of OpenSearch, the latest OpenSearch version available will be installed on your Ubuntu system.
apt install opensearch
It is also possible to install a specific version of OpenSearch.
apt install opensearch=<version>
An example is opensearch=2.10.0
The default configuration file for OpenSearch is available in /etc/opensearch/opensearch.yml
. You can edit this file according to the desired parameters specified by the applications in your environment.
nano /etc/opensearch/opensearch.yml
We can set something like cluster.name among many other customizable values.
cluster.name: my-green1
After installing and configuring OpenSearch, start and enable the service to start at system boot.
systemctl restart opensearch
systemctl enable --now opensearch
Check if the OpenSearch service has been launched successfully.
$ systemctl status opensearch
Install the OpenSearch console
You can install OpenSearch Dashboards which provide an integrated solution for data visualization and data observability.
Add OpenSearch Console APT repository.
echo "deb https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/2.x/apt stable main" | tee -a /etc/apt/sources.list.d/opensearch-2.x.list
Update the package index and install OpenSearch Console.
apt update && apt install opensearch-dashboards
apt-get install opensearch-dashboards=2.10.0 #Or you can install the version you want
To allow access from an external IP address, set it to listed on 0.0.0.0 (Listen on all network interfaces)
$ nano /etc/opensearch-dashboards/opensearch_dashboards.yml
server.host: "0.0.0.0"
server.port: 5601
opensearch.hosts: [http://localhost:9200]
Other options can be modified in the file. When done, reboot and enable the service.
systemctl restart opensearch-dashboards
systemctl enable opensearch-dashboards
From a web browser, navigate to the OpenSearch Console. The default port is 5601.
The default login information is:
- username admin
- password admin
On success, you will get the following page with the message ‘Welcome to the OpenSearch Console’. You can now click ‘ Add Data ‘ to add new data to your OpenSearch server or click ‘ Explore My Own’ to set it up later.
Check out and use OpenSearch
Next, to ensure that the OpenSearch Dashboard is connected to the OpenSearch server, you will perform the following steps:
Click on the left menu move to the Management section and click on “ Dev Tools ”.
Now enter the query ‘ GET/ ‘ on the console and click on the play button. On success, you will see output on the right with detailed information about your OpenSearch server. Additionally, you can see at the top right the HTTP code ‘ 200 – OK ‘ confirming that the query executed without errors.
With this in mind, you have now completed the process of installing OpenSearch Dashboard on your Debian server via Tarball. And also configured the OpenSearch Console to connect to the OpenSearch server.