Oct 13, 2023 4 min read

How to Install Elasticsearch on Debian 10

Install Elasticsearch on Debian 10 with our step-by-step tutorial. An open-source search and analytics engine for large-scale data handling.

Install Elasticsearch on Debian 10
Table of Contents

Choose a different version or distribution

Introduction

Before we begin talking about how to install Elasticsearch on Debian 10, let's briefly understand – What is Elasticsearch?

Elasticsearch is a powerful, open-source search and analytics engine designed to handle large amounts of data. It allows you to quickly search and analyze your data in real-time, making it valuable for various applications, including e-commerce, log analysis, and social media monitoring.

With its distributed nature, Elasticsearch offers high scalability and fault tolerance. It supports advanced search features, enables complex querying, and provides near-instant retrieval of results. Its flexibility, speed, and robustness make Elasticsearch an essential tool for businesses seeking efficient data management and actionable insights.

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

Advantages of Elasticsearch

  1. Fast and Real-time: Elasticsearch offers lightning-fast search and analytics capabilities, allowing you to retrieve and analyze your data in real-time.
  2. Scalable and Distributed: With its distributed nature, Elasticsearch can handle large amounts of data and scale horizontally to meet growing demands.
  3. Powerful Search Features: Elasticsearch supports advanced search functionalities like full-text search, geo-location search, and fuzzy matching, enabling precise querying.
  4. High Availability: Elasticsearch ensures fault tolerance by replicating data across multiple nodes, minimizing downtime and ensuring continuous availability of searches.
  5. Easy Integration: Elasticsearch seamlessly integrates with various programming languages, databases, and data sources, making it easy to adopt and work with existing systems.

How to install Elasticsearch on Debian 10

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 10 using one of two methods:

  • through the repository's Debian 10 import of the GPG key.
  • directly from the Elasticsearch official website.

Through the repository's Debian 10 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 10:

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 10 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 10 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 10 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-8.8.2-amd64.deb

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

sudo apt install ./elasticsearch-8.8.2-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 10, 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 10, we will use the command that follows:

sudo apt remove elasticsearch -y

The removal of Elasticsearch was successful.

FAQs to Install Elasticsearch on Debian 10

Is it necessary to install Java before installing Elasticsearch? 

Yes, Elasticsearch requires Java to be installed. It is recommended to install the latest compatible version of Java before installing Elasticsearch.

How can I access the Elasticsearch API? 

The Elasticsearch API is accessible via HTTP on port 9200. You can use tools like cURL or web browsers to interact with it.

How can I change the Elasticsearch listening port? 

Open the configuration file and modify the http.port setting. Then, restart Elasticsearch for the changes to take effect.

How can I secure the Elasticsearch installation? 

Elasticsearch provides various security features like TLS/SSL encryption, authentication, and role-based access control. Refer to the official documentation for detailed instructions.

How can I restart Elasticsearch? 

You can restart Elasticsearch by running: sudo systemctl restart elasticsearch

How do I start and stop Elasticsearch on Debian 10? 

You can start or stop Elasticsearch by running the respective commands: systemctl start elasticsearch and systemctl stop elasticsearch.

How can I change the Elasticsearch default settings? 

You can modify the Elasticsearch settings by editing the configuration file (elasticsearch.yml) to suit your requirements. However, be cautious while changing the default settings.

Conclusion

Elasticsearch is a JSON-document-based search engine that searches and retrieves data using the Lucene library. It can be installed in practically all Linux distributions, but this tutorial will discuss how to install Elasticsearch on the most recent Debian version using both of these methods—directly from the website and using the repository in detail.

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.