How to Install OpenSearch on Ubuntu 24.04

Introduction

OpenSearch is a community-driven, open-source search and analytics suite. In this guide, you will learn how to install OpenSearch on Ubuntu 24.04.

Prerequisites

  • Ubuntu 24.04 installed
  • Access to a terminal/command line
  • sudo privileges

Step 1: Install Java Runtime

OpenSearch requires Java. You can install OpenJDK using the following command:

sudo apt update
sudo apt install openjdk-11-jdk

Verify Java Installation

To ensure Java is installed correctly, run:

java -version

Step 2: Add OpenSearch GPG Key

Next, you need to add the OpenSearch GPG Key to your system:

wget -qO - https://artifacts.opensearch.org/GPG-KEY | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/opensearch.gpg

Step 3: Add OpenSearch Repository

Add the OpenSearch repository to your sources list:

echo "deb https://artifacts.opensearch.org/packages/opensearch-2.x/apt/ stable main" | sudo tee /etc/apt/sources.list.d/opensearch.list

Step 4: Install OpenSearch

After adding the repository, update the package list and install OpenSearch:

sudo apt update
sudo apt install opensearch

Step 5: Configure OpenSearch

You can configure OpenSearch by editing the configuration file located at /etc/opensearch/opensearch.yml. Use your preferred text editor (e.g., nano or vim):

sudo nano /etc/opensearch/opensearch.yml

Step 6: Start OpenSearch

Start the OpenSearch service with the following command:

sudo systemctl start opensearch

Enable OpenSearch on Boot

To ensure OpenSearch starts automatically on boot, run:

sudo systemctl enable opensearch

Step 7: Verify Installation

You can verify that OpenSearch is running by checking the service status:

sudo systemctl status opensearch

Conclusion

You have successfully installed OpenSearch on your Ubuntu 24.04 system. You can now access it through its REST API or integrate it into your applications.

Resources