Site icon DesignLinux

How to Install Elasticsearch on Debian 11

how-to-install-elasticsearch-on-debian-11

Elasticsearch is an open-source, analytical and full-text search engine. It provides a distributed, multitenant-capable architecture which enables you to store, search and analyze large volumes of data faster. Elastic search is freely available under the Apache 2 license, which provides the most flexibility. In this guide you will learn how to install Elasticsearch on Debian 11.

How to Install Elasticsearch on Debian 11

Perform the following steps to install Elasticsearch on Debian 11:

Step 1 – Update your system

First of all you should update your system using following command:

sudo apt update

Step 2 – Import Elasticsearch GPG Key

We need to import GPG key to make sure the download source is correct and secure. Import using the following wget command:

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

It should print OK as an output, that means the key has been successfully imported, and packages from this repository will be considered trusted.

Step 3 – Add Packages

Once the GPG key is imported you may need apt-transport-https to be present on you Debian system. Issue the following command to get it:

sudo apt-get install apt-transport-https

Step 4 – Add Repository to System

Run the following command to add the Elasticsearch repository to the system:

sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'

Step 5 – Installing Elasticsearch

Next, update the packages index and install the Elasticsearch engine using following commands:

sudo apt update
sudo apt install elasticsearch

After the installation, a default configuration file will be populated to /etc/elasticsearch/elasticsearch.yml. Modify this file to your liking. For example, you can set the correct cluster name for your applications:

cluster.name: testcluster

By default, the minimum memory set for JVM is 2GB, if your server have not large memory size then you must change this value:

sudo nano /etc/elasticsearch/jvm.options

Change value from:

-Xms2g
-Xmx2g

To value:

-Xms512m
-Xmx512m

It’s recommended to set the min and max JVM heap size to the same value. Xms represents the initial size of total heap space and Xmx represents the maximum size of total heap space.

After completion of the process, start, and enable the service:

sudo systemctl enable elasticsearch.service --now

Conclusion

This tutorial shown you how to install Elasticsearch on Debian 11. To get more details about Elasticsearch visit the official documentation page.

If you face any problem or having a feedback, feel free to leave a comment below.

Exit mobile version