Installing OpenSearch: A Step-by-Step Guide

In this article, we’ll walk you through the process of installing OpenSearch on your Linux system.

OpenSearch is a distributed search and analytics engine that supports various use cases, from implementing a search box on a website to analyzing security data for threat detection.

Prerequisites

Before proceeding, ensure that you have the necessary dependencies installed on your system. These include:

  • lsb-release
  • ca-certificates
  • curl
  • gnupg2

If these dependencies are not already installed, you can install them using the following commands:

apt-get update && apt-get -y install lsb-release ca-certificates curl gnupg2

Step 1: Add OpenSearch Keyring

To verify the authenticity of the OpenSearch package, we need to add its GPG keyring to our system. Run the following command:

curl -o- https://artifacts.opensearch.org/publickeys/opensearch.pgp | gpg --dearmor --batch --yes -o /usr/share/keyrings/opensearch-keyring

This command downloads the OpenSearch GPG key and saves it to /usr/share/keyrings/opensearch-keyring.

Step 2: Configure Package Sources

Next, we need to configure our package sources to include the OpenSearch repository. Run the following command:

echo "deb [signed-by=/usr/share/keyrings/opensearch-keyring] https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/apt stable main" | tee /etc/apt/sources.list.d/opensearch-2.x.list

This command adds the OpenSearch repository to our package sources.

Step 3: Update Package Index

Now that we’ve configured our package sources, it’s time to update the package index. Run the following command:

apt-get update

This command updates the package index to reflect any changes made in Step 2.

Step 4: Install OpenSearch

Finally, we can install OpenSearch using the following command:

env OPENSEARCH_INITIAL_ADMIN_PASSWORD=<custom-admin-password> apt-get install opensearch

Replace <custom-admin-password> with a strong password of your choice for the initial admin user. This command installs OpenSearch and its dependencies.

Verification

Once the installation is complete, you can verify that OpenSearch has been installed successfully by running:

systemctl status opensearch

This command checks the status of the OpenSearch service.

That’s it! With these steps, you should now have OpenSearch installed on your Linux system. You can use the following command to start and enable the service:

systemctl start opensearch
systemctl enable opensearch

This article has outlined the steps for installing OpenSearch on Linux.

Leave a Comment