Elasticsearch is a highly scalable and distributed open-source full-text search and analytics engine tool. It is designed to store, search, and analyze large volumes of data in real-time, making it a popular tool for a variety of use cases such as log analytics, e-commerce product search, and security analytics.
Elasticsearch uses a document-oriented data model, which means that it stores data in JSON documents that can be easily searched and analyzed. It also provides a powerful query language called Elasticsearch Query DSL, which allows users to perform complex queries on the data stored in the engine.
In this tutorial, we will show you how to install Elasticsearch
on Debian 11.
Step 1: Update Operating System
Update your Debian 11 operating system to make sure all existing packages are up to date:
# apt update && apt upgrade
Also, install:
# apt install curl wget gnupg apt-transport-https
Step 2: Add Elasticsearch Repository
By default, Elasticsearch
is not included in the Debian 11 default repository. So you will need to add the Elasticsearch
repository to APT.
First, import the Elasticsearch
GPG key.
# wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
Then add the Elasticsearch
repository.
# echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list
Once you are done, update the repository with the following command:
# apt update
Step 3: Install and Configure Elasticsearch
Now, you can install the Elasticsearch
using the following command:
# apt install elasticsearch
After installation is completed, edit Elasticsearch
configuration file “/etc/elasticsearch/elasticsearch.yml
”:
# nano /etc/elasticsearch/elasticsearch.yml
Add the following content:
cluster.name: LinuxTuto
node.name: Debian 11
path.data: /var/lib/elasticsearch
network.host: 127.0.0.1
xpack.security.enabled: false
Then start and enable the service.
# systemctl start elasticsearch
# systemctl enable elasticsearch
To confirm the status of the service of Elasticsearch
, run the command:
$ sudo systemctl status elasticsearch.service
● elasticsearch.service - Elasticsearch
Loaded: loaded (/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
Active: active (running)
Docs: https://www.elastic.co
Main PID: 73979 (java)
Tasks: 100 (limit: 2301)
Memory: 1.3G
CPU: 53.939s
CGroup: /system.slice/elasticsearch.service
├─73979 /usr/share/elasticsearch/jdk/bin/java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=/usr/share/elasticsearch/bin/elast>
├─74040 /usr/share/elasticsearch/jdk/bin/java -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -Djava.security.manage>
└─74063 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller
Step 4: Test Elasticsearch
To verify that Elasticsearch
is running correctly, you can use the curl command:
# curl -X GET "localhost:9200/"
If Elasticsearch
is working properly, the result should be like this:
{
"name" : "Debian 11",
"cluster_name" : "LinuxTuto",
"cluster_uuid" : "ezWPhn_fQLS5dcSiexroQA",
"version" : {
"number" : "8.7.0",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "09520b59b6bc1057340b55750186466ea715e30e",
"build_date" : "2023-03-27T16:31:09.816451435Z",
"build_snapshot" : false,
"lucene_version" : "9.5.0",
"minimum_wire_compatibility_version" : "7.17.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "You Know, for Search"
}
This means that Elasticsearch
is active and running on your server.
Step 5: Uninstall Elasticsearch
Run the following script to remove Elasticsearch from your system.
# apt remove elasticsearch
Comments and Conclusion
In this tutorial we have installed the free version which is released under the Elastic license. You can check the Subscriptions page for more information about Elastic license levels.
For additional help or useful information, you can check the official Elasticsearch Documentation.
If you have any questions please leave a comment below.