DebianLinuxTutorials

How To Install Elasticsearch on Debian 11

Install Elasticsearch on Debian 11

In this tutorial, we will show you how to install Elasticsearch on Debian 11. For those of you who didn’t know, Elasticsearch is the distributed, RESTful search and analytics engine at the heart of the Elastic Stack. Elasticsearch is well-liked and popular amongst sysadmins and developers as it is a mighty search engine based on the Lucene library. It is generally used as the underlying engine/technology that powers applications with complex search features and requirements.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step-by-step installation of Elasticsearch on a Debian 11 (Bullseye) server.

Prerequisites

  • A server running one of the following operating systems: Debian 11 (Bullseye).
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Elasticsearch on Debian 11 Bullseye

Step 1. Before we install any software, it’s important to make sure your system is up to date by running the following apt commands in the terminal:

sudo apt update
sudo apt upgrade
sudo apt install apt-transport-https

Step 2. Installing Java.

Elasticsearch deployment requires that Java 8 or 11 is installed. Run the below commands to install OpenJDK on your system:

sudo apt install default-jdk

Confirm Java installation by checking on the version:

java -version

Step 3. Installing Elasticsearch on Debian 11.

Elasticsearch is not available in the standard Debian 11 repositories, now we add the Elasticsearch APT repository to your system:

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
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 that, install the Elasticsearch package using apt commands below:

sudo apt update
sudo apt install elasticsearch

Start and enable the Elasticsearch service:

sudo systemctl enable elasticsearch.service --now

To verify and check if Elasticsearch is running, we can execute the following command:

curl -X GET "localhost:9200"

To view the system message that Elasticsearch logs on your system, type the following command:

sudo journalctl -u elasticsearch

Step 4. Configure Elasticsearch.

By default, Elasticsearch listens only to localhost. To change this, open up the configuration file as follows:

sudo nano /etc/elasticsearch/elasticsearch.yml

Add the following lines at the end of the file:

network.host: 127.0.0.1
http.host: 0.0.0.0
http.port: 9200

Restart the Elasticsearch service with the following command for changes to take effect:

sudo systemctl restart elasticsearch

Step 5. Configure Firewall.

Now enable access to port 9200 from the local firewall:

sudo ufw allow 9200

Congratulations! You have successfully installed Elasticsearch. Thanks for using this tutorial for installing Elasticsearch on Debian 11 (Bullseye) system. For additional help or useful information, we recommend you to check the official Elasticsearch website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button