From an APT repository
Install the necessary packages.
sudo apt-get update && sudo apt-get -y install lsb-release ca-certificates curl gnupg2
Import the public GPG key. This key is used to verify that the APT repository is signed.
curl -o- https://artifacts.opensearch.org/publickeys/opensearch.pgp | sudo gpg --dearmor --batch --yes -o /usr/share/keyrings/opensearch-keyring
Create an APT repository for OpenSearch:
echo "deb [signed-by=/usr/share/keyrings/opensearch-keyring] https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/apt stable main" | sudo tee /etc/apt/sources.list.d/opensearch-2.x.list
Verify that the repository was created successfully.
sudo apt-get update
With the repository information added, list all available versions of OpenSearch:
sudo apt list -a opensearch
Choose the version of OpenSearch you want to install:
sudo apt-get install opensearch
To install a specific version of OpenSearch:
# Specify the version manually using opensearch=<version>sudo apt-get install opensearch=2.7.0
Once complete, enable OpenSearch.
sudo systemctl enable opensearch
Start OpenSearch.
sudo systemctl start opensearch
sudo systemctl status opensearch
To verify that OpenSearch installed correctly.
Send a request to port 9200:
curl -X GET https://localhost:9200 -u 'admin:admin' --insecure
get a response that looks like this:
{
"name" : "hostname",
"cluster_name" : "opensearch",
"cluster_uuid" : "6XNc9m2gTUSIoKDqJit0PA",
"version" : {
"distribution" : "opensearch",
"number" : <version>,
"build_type" : <build-type>,
"build_hash" : <build-hash>,
"build_date" : <build-date>,
"build_snapshot" : false,
"lucene_version" : <lucene-version>,
"minimum_wire_compatibility_version" : "7.10.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "The OpenSearch Project: https://opensearch.org/"
}