Initially, Elasticsearch was launched as Compass in 2004 by Shay Banon, later in 2010, it was released as the Elasticsearch. Elasticsearch is an open-source search engine that depends on the Lucene library, which is used for RESTful operations like searching, storing, and analyzing large data. It is also supported by the full-text engine and HTTP web interface as well as it supports the schemaless JSON documents, which can be known as NoSQL database.
Some of the features of Elasticsearch are:
- Real-time searching
- Scalable searching
- Support of multitenancy
- Clustering and high availability
- Elastic clouds
Elasticsearch is supported by different operating systems, in this follow-up, we will discuss the installation procedure of the installation of Elasticsearch on the latest release of Debian which is known as Debian Bullseye as well as Debian 11.
How to install Elasticsearch on Debian 11
Before going towards installation, it is recommended to update all the packages of Debian by using the command:
$ sudo apt update
There is one package that requires upgradation, so we will upgrade it using the command:
$ sudo apt upgrade -y
Now as all the packages are up to date so we will proceed towards the installation procedure of Elasticsearch. There are two methods to install the Elastic search on Debian 11 which are:
- By importing the GPG key to Debian 11 repository
- Directly from the official website of Elasticsearch
By importing the GPG key to Debian 11 repository:
We can install Elasticsearch on Debian 11 by importing its GPG key from the official website of the Elasticsearch using the wget command:
$ wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
Once the GPG key is successfully imported, OK will be displayed in the output, now import the source repository of the Elasticsearch to the repository of Debian 11 using the command:
$ echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list
Now when both; GPG key and the source repository have been added to the repository of Debian 11, update it once again.
$ sudo apt update
After the update, initialize the installation of the Elasticsearch using the command:
$ sudo apt install elasticsearch
The Elasticsearch has been installed.
Directly from the official website of Elasticsearch:
We can also directly install Elasticsearch from its official website instead of importing its key to the repository of Debian 11. For this purpose, first, we will send the HTTP request to the server of Elasticsearch server to connect with it using the command:
$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.1-amd64.deb
Now execute the following command to install the package Elasticsearch on Debian 11:
$ sudo apt install ./elasticsearch-7.15.1-amd64.deb
The installation will be initialized and it will ask you to continue, type ‘y’, and wait for some time as the installation will take a few moments.
Once the installation is completed, we will enable the service of Elasticsearch. By default, the service of Elasticsearch is disabled on Debian 11, to make it enable we will use the command of systemctl as:
$ sudo systemctl enable elasticsearch.service --now
Now to start the Elasticsearch service using the systemctl command:
$ sudo systemctl start elasticsearch.service
To confirm the status of the service of Elasticsearch, run the command:
$ sudo systemctl status elasticsearch.service
After the successful running of the Elasticsearch service,we will configure it firewall settings of it by enabling the port 9200 using the command of ufw:
$ sudo ufw allow 9200
We can get the details of the install version of the Elasticsearch by executing the command:
$ curl -X GET "http://localhost:9200/?pretty"
Now, if we want to remove the package of Elasticsearch from the Debian 11, we will execute the following command:
$ sudo apt remove elasticsearch -y
The Elasticsearch has been removed successfully.
Elasticsearch is a JSON document-based search engine that uses the Lucene library to search and fetch data. It can be installed in almost every distribution of Linux, but this follow-up will help to understand the installation steps of Elasticsearch on the latest version of Debian by both means; using its repository as well as directly from the website, both of these methods are discussed in detail.
TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY