Debian

How to install Elasticsearch on Debian 11

Elasticsearch is an open source and distributed analytical supported search engine to store and retrieve data like any other database does so therefore it is also a well-known database that lies in the NoSQL category of databases; these kinds of databases are technologically modern and picture, videos can be stored in a document form using NoSQL databases.

As it is a NoSQL type of database, it does not follow SQL to process data. Therefore, Elasticsearch uses Query Domain Specific Language (DSL) to perform basic operations on data. Elasticsearch also provides support to fetch and represent the data analytically or an analytical compassion can also be drawn between several kinds of data.

Thus, due to its analytical representation of data; it is also referred to as an analytical search engine as well. Elasticsearch databases focus on searching and retrieving the data efficiently therefore it is also known as a search engine too. The data stored in Elasticsearch can be retrieved and several operations can be performed using its robust search feature.

In this detailed post, we have provided the demonstration to install Elasticsearch on Debian 11.  Before proceeding to the installation, let’s have a look at how Elasticsearch works to process data in form of document:

How Elasticsearch works

The data is sent to Elasticsearch in the JSON document form by using API or Logstash. The Logstash plugin acts as a pipeline for Elasticsearch that receives data from several sources, processes it and sends it to the destination. After that, Elasticsearch stores that document and adds a reference number to it for further retrieval of data from the document. Once Elasticsearch has assigned the reference; one can retrieve that document by using API: Moreover, virtualization tools can be used along with Elasticsearch to get the output in visualized form.

How to install Elasticsearch on Debian 11

There are two methods to get Elasticsearch on your Debian 11:

Method 1: Using apt repository on Debian 11
Method 2: Using Debian package

First method refers to the installation using APT repository whereas second method is used to install Elasticsearch by downloading and installing Debian package: let’s dig into both methods one by one:

Method 1: How to install Elasticsearch using APT repository on Debian 11

The prerequisites for installation of Elasticsearch on Debian 11 are listed below:

  • Availability of latest Java version
  • Elasticsearch GPG key

Step 1: Update and Upgrade Debian 11 packages list
It is good practice to update and upgrade the list of packages, so that you can get the updated packages:

For this, use the following command to update and upgrade the packages simultaneously:

$ sudo apt update && sudo apt upgrade

Step 2: Get the GPG key
Add the GPG key to ensure the download source is secure and acceptable: you can do so by using the command mentioned below:

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

Note: The warning in the above image points that the apt-key is depreciated (after Debian 11 and Ubuntu 22.04) and will be available only to delete existing keys from keyring.

Step 3: Add apt-transport-https package
After adding the GPG key, the apt-transport-https may also be required to be present at your Debian: you can get it by issuing the command mentioned below:

$ sudo apt-get install apt-transport-https

Once apt-transport-https is available for your Debian 11; use the following command to save repository to /etc/apt/sources.list.d/elastic-7.x.list:

$ echo “deb https://artifacts.co/packages/7.x/apt stablemain” | sudo tee /etc/apt/sources.list.d/elastic-7.x.list

The “7.x” in the above command shows the latest version of Elasticsearch will be added.

Step 4: Installation of Elasticsearch
Once you have completed above steps successfully; you have to update the repository list by issuing the below mentioned command:

$ sudo apt update

After updating the system, use the command mentioned below to install Elasticsearch on your Debian 11 system:

$ sudo apt install elasticsearch

Method 2: How to install Elasticsearch using Debian package on Debian 11

You can download and install Elasticsearch from official site of Elastic:

Step 1: Download Elasticsearch

$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.14.1-amd64.deb

Now perform the hashing function on the downloaded file by issuing the command mentioned below:

$ wget https://artifacts.elastic.co/downloads/elasticsearch-7.14.1-amd64.deb.sha512

You can check the successful execution and authenticity of the received data: for this, you can use below mentioned command:

$ shasum -a 512 -c elasticsearch-7.14.1-amd64.deb.sha512

Step 2: Installation
After application of checksum technique, install the .deb package by issuing the command mentioned below:

$ sudo dpkg -i elasticsearch-7.14.1-amd64.deb

Conclusion

Elasticsearch is a distributed multipurpose package and therefore it is represented by several names like search engine or analytical search engine and also a well-known NoSQL database as well. Due to the multi-functional property of Elasticsearch, it is used for full text search, business analytics, operational and security intelligence. In this post, we have presented an installation guide to get Elasticsearch on Debian 11: there are two methods listed in this article, you can follow any one of them to install Elasticsearch.

About the author

Adnan Shabbir