Install dependencies to add the new repo
apt update && \
apt install lsb-release ca-certificates curl gnupg2 -y
Add the repositories public key
curl -o- https://artifacts.opensearch.org/publickeys/opensearch.pgp | sudo gpg --dearmor --batch --yes -o /etc/apt/keyrings/opensearch
Add the repository
echo "deb [signed-by=/etc/apt/keyrings/opensearch] https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/apt stable main" | tee /etc/apt/sources.list.d/opensearch-2.x.list
Install OpenSearch. You must supply an initial admin password.
export OPENSEARCH_INITIAL_ADMIN_PASSWORD=************ && \
apt install opensearch
Concluding the APT installation, you'll probably see the following output
### NOT starting on installation, please execute the following statements to configure opensearch service to start automatically using systemd
sudo systemctl daemon-reload
sudo systemctl enable opensearch.service
### You can start opensearch service by executing
sudo systemctl start opensearch.service
### Create opensearch demo certificates in /etc/opensearch/
See demo certs creation log in /var/log/opensearch/install_demo_configuration.log
### Breaking change in packaging since 2.13.0
In 2.13.0 and later releases of OpenSearch, we have changed the permissions associated with access to installed files
If you are configuring tools that require read access to the OpenSearch configuration files, we recommend you add the user that runs these tools to the 'opensearch' group
For more information, see https://github.com/opensearch-project/opensearch-build/pull/4043
Enable the systemd service.
systemctl daemon-reload && \
systemctl enable --now opensearch.service && \
systemctl status opensearch.service
OpenSearch is running in, what is considered, “Demo Mode" at this point. Let's prepare OpenSearch for production use.
For production workloads running on Linux, make sure the Linux setting vm.max_map_count is set to at least 262144. Even if you use the Docker image, set this value on the host machine. To check the current value, run this command:
cat /proc/sys/vm/max_map_count
To increase the value, create a new sysctl file and add the updated value
touch /etc/sysctl.d/50-opensearch-mods.conf && \
echo "vm.max_map_count=262144" >> /etc/sysctl.d/50-opensearch-mods.conf
Create the config directory and config file
mkdir /etc/opensearch/config/ && \
touch /etc/opensearch/config/jvm.options
Use this table to select the options you want to set and add them to the jvm.options file.
Enable memory locking in the Opensearch config
sed -i "s/bootstrap.memory_lock: false/bootstrap.memory_lock: true/" /etc/opensearch/opensearch.yml
Debian uses systemd to handle swap devices and processes - you must add the following to the Opensearch service, as an override.
mkdir /etc/systemd/system/opensearch.service.d && \
bash -c "cat > /etc/systemd/system/opensearch.service.d/override.conf" <<'EOF'
[Service]
LimitMEMLOCK=infinity
EOF
Finally, follow this guide to disable swap for the host system. The latter config will cause Opensearch to fail its startup checks if you do not disable the host system's use of swap.