In this article, we will have explained the necessary steps to install and setup Elasticsearch on Debian 10. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.
Elasticsearch is a versatile and highly effective open source, distributed real-time search and analytics engine. Utilizing a easy set of APIs, it offers the flexibility for full-text search. Elastic search is freely available under the Apache 2 license, which offers probably the most flexibility.
Install Elasticsearch on Debian
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo apt update sudo apt upgrade
Step 2. Install Java.
Elasticsearch is a Java application, so the first step is to install Java. Run following commands to install Java:
sudo apt install default-jdk
Verify the Java installation:
java -version
Step 3. Install Elasticsearch.
Use Elasticsearch official apt repository to install Elasticsearch on Debian Linux system:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
Add the Elasticsearch repository to the system by running:
sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'
After adding the repository to your system. Run the following commands to update cache and then install Elasticsearch packages on your system:
sudo apt update sudo apt install elasticsearch
Once the installation is done, you can start elasticsearch service by executing:
sudo systemctl enable elasticsearch.service --now
Step 4. Configure Elasticsearch.
You can customize this by editing the Elasticsearch configuration file. Edit configuration file in your favorite text editor and update the following values:
sudo nano /etc/elasticsearch/elasticsearch.yml
Change the following values:
network.host: 0.0.0.0 cluster.name: ES_Cluster_01 node.name: "Cluster_01_Node_001"
Restart the Elasticsearch service for the changes to take effect:
sudo systemctl restart elasticsearch
Step 5. Verify Elasticsearch Setup.
You can verify that Elasticsearch is running by sending an HTTP request to port 9200 on localhost with the following curl command:
curl -X GET "localhost:9200/"
You should see something similar to this:
{ "name" : "kwEgdT2Q", "cluster_name" : "elasticsearch", "cluster_uuid" : "B-5B34LramonaD3ww", "version" : { "number" : "6.6.6", "build_flavor" : "default", "build_type" : "deb", "build_hash" : "1fbmw60", "build_date" : "2020-02-13T17:10:46.160287Z", "build_snapshot" : false, "lucene_version" : "8.6.0", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.1.0" }, "tagline" : "You Know, for Search" }
Congratulation, you have learned how to install and configure Elasticsearch on Debian Buster. If you have any question, please leave a comment below.