Oct 11, 2023 4 min read

How to Install Elasticsearch on Debian 11

Install Elasticsearch on Debian 11 with our step-by-step tutorial. It is a distributed search and analytics engine based on the Lucene library.

Install Elasticsearch on Debian 11
Table of Contents

Choose a different version or distribution

Introduction

Before we start talking on how to install Elasticsearch on Debian 11, let's briefly understand - What is Elasticsearch?

Elasticsearch is a powerful-distributed search and analytics engine that allows for efficient and scalable indexing, search, and analysis of large volumes of data.

Installing Elasticsearch on Debian 11 enables you to leverage its capabilities for various applications such as logging, monitoring, and data visualization.

In this tutorial, you will install Elasticsearch on Debian 11. We will also address a few FAQs on how to install Elasticsearch on Debian 11.

Advantages of Installing Elasticsearch on Debian 11

  1. Efficient Search and Analytics: Elasticsearch provides fast and accurate search capabilities, making it ideal for applications that require real-time querying and analysis of large volumes of structured and unstructured data.
  2. Scalability and Performance: Elasticsearch is designed to scale horizontally by distributing data across multiple nodes, allowing for high availability, fault tolerance, and increased performance.
  3. Rich Ecosystem: Elasticsearch is part of the Elastic Stack, which includes various complementary tools and solutions like Kibana for data visualization and Logstash for data processing.
  4. Easy Integration: Elasticsearch provides a RESTful API and supports various programming languages, making it easy to integrate and interact with other systems and platforms.
  5. Community and Support: Elasticsearch has a vibrant and active community of developers, contributors, and users.

How to install Elasticsearch on Debian 11

It is advised to update all of Debian's packages before beginning installation by running the command:

sudo apt update

One package needs to be upgraded, therefore we'll do that by running the following command:

sudo apt upgrade -y

Now that all the packages are updated, we can start the Elasticsearch installation process. Elastic search can be installed on Debian 11 using one of two methods:

  • Through the repository's Debian 11 import of the GPG key.
  • Directly from the Elasticsearch official website.

Through the repository's Debian 11 import of the GPG key

Using the wget command, we can import Elasticsearch's GPG key from the company's official website and then install it on Debian 11:

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

Once the GPG key has been imported successfully, OK will be shown in the output. Use the following command to import the Elasticsearch source repository into the Debian 11 repository:

echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list

Update it once more after the GPG key and the source repository have been added to the Debian 11 repository.

sudo apt update

After the update, use the following command to start the Elasticsearch installation:

sudo apt install elasticsearch 

Elasticsearch has been set up.

Directly from the Elasticsearch official website

Instead of importing Elasticsearch's key into the Debian 11 repository, we may also install it straight from the company's website. To accomplish this, we will first use the following command to submit an HTTP request to the Elasticsearch server in order to establish a connection:

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

To install the package Elasticsearch on Debian 11, now run the command below:

sudo apt install ./elasticsearch-7.15.1-amd64.deb

The installation will begin and prompt you to continue. Type "y" and wait until it completes, which will take a little while.

After the installation is complete, we will turn on the Elasticsearch service. On Debian 11, the Elasticsearch service is disabled by default. To enable it, use the systemctl command as follows:

sudo systemctl enable elasticsearch.service --now 

Now, use the systemctl command to launch the Elasticsearch service:

sudo systemctl start elasticsearch.service 

Run the following command to verify Elasticsearch's service status:

sudo systemctl status elasticsearch.service

After the Elasticsearch service has successfully run, we will adjust its firewall settings by opening port 9200 using the ufw command:

sudo ufw allow 9200 

By using the following command, we may obtain information about the Elasticsearch installation version:

curl -X GET "http://localhost:9200/?pretty"

Now, if we want to uninstall the Elasticsearch package from Debian 11, we will use the command that follows:

sudo apt remove elasticsearch -y

The removal of Elasticsearch was successful.

FAQs on Installing Elasticsearch on Debian 11

What are the requirements for installing Elasticsearch on Debian 11? 

To install Elasticsearch on Debian 11, you need a compatible version of Java (OpenJDK or Oracle JDK) and appropriate system resources (CPU, RAM, disk space) based on your data volume and usage requirements.

Which Java version is compatible with Elasticsearch on Debian 11? 

Elasticsearch requires a version of Java 11. It is recommended to use OpenJDK 11 or Oracle JDK 11, both of which are compatible with Debian 11.

What is the recommended installation method for Elasticsearch on Debian 11?

The official Elasticsearch documentation recommends installing Elasticsearch via the official APT package repository. This method ensures easy installation, updates, and compatibility with the Debian package management system.

Can I install Elasticsearch without using the official APT repository on Debian 11? 

Yes, it is possible to manually download the Elasticsearch package and install it, but using the official APT repository is recommended for easy installation, updates, and package management.

Do I need to install any additional dependencies before installing Elasticsearch on Debian 11? 

No, the official Elasticsearch package for Debian 11 already includes the necessary dependencies. It will automatically install any required dependencies during the installation process.

How do I start and stop the Elasticsearch service on Debian 11? 

You can start and stop the Elasticsearch service on Debian 11 using the systemd service management commands: sudo systemctl start elasticsearch to start the service, and sudo systemctl stop elasticsearch to stop it.

How can I access the Elasticsearch web interface on Debian 11? 

Elasticsearch does not provide a web interface by default. However, you can use various tools such as Kibana or Elasticsearch's own developer tools plugin to interact with and visualize data stored in Elasticsearch.

Conclusion

Installing Elasticsearch on Debian 11 allows you to harness the power of a distributed search and analytics engine for efficient indexing, search, and analysis of data.

By following the installation process and configuring Elasticsearch, you can take advantage of its scalable and real-time capabilities to enhance various applications, including logging, monitoring, and data visualization.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.