How to Install Elasticsearch on Debian 13
Elasticsearch is a highly scalable open-source full-text search and analytics engine. It allows you to store, search, and analyze big volumes of data quickly and in near real-time. Elasticsearch is an open-source developed in Java and used by many big organizations around the world.
Updated System and Install OpenJDK
First, update the packages index and install the latest version of OpenJDK with the following commands.
apt update
apt install sudo -y
OpenJDK packages are available under native apt repositories. You can simply use the apt-cache search command to search for the available Java version for your Debian system.
apt-cache search openjdk
Output:
root@server:~# apt-cache search openjdk
libasmtools-java - OpenJDK AsmTools
libeclipse-collections-java - Eclipse Collections - comprehensive collections library for Java
libhsdis0-fcml - HotSpot disassembler plugin using FCML
default-jdk - Standard Java or Java compatible Development Kit
default-jdk-doc - Standard Java or Java compatible Development Kit (documentation)
default-jdk-headless - Standard Java or Java compatible Development Kit (headless)
default-jre - Standard Java or Java compatible Runtime
default-jre-headless - Standard Java or Java compatible Runtime (headless)
libjax-maven-plugin - Using the xjc goal with OpenJDK 11+
jtreg - Regression Test Harness for the OpenJDK platform
jtreg6 - Regression Test Harness for the OpenJDK platform
jtreg7 - Regression Test Harness for the OpenJDK platform
libreoffice - office productivity suite (metapackage)
lyx - document processor
openjdk-21-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-21-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-21-doc - OpenJDK Development Kit (JDK) documentation
openjdk-21-jdk - OpenJDK Development Kit (JDK)
openjdk-21-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-21-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-21-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-21-jre-zero - Alternative JVM for OpenJDK, using Zero
openjdk-21-source - OpenJDK Development Kit (JDK) source files
openjdk-21-testsupport - Java runtime based on OpenJDK (regression test support)
openjdk-25-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-25-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-25-doc - OpenJDK Development Kit (JDK) documentation
openjdk-25-jdk - OpenJDK Development Kit (JDK)
openjdk-25-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-25-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-25-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-25-jre-zero - Alternative JVM for OpenJDK, using Zero
openjdk-25-jvmci-jdk - JVMCI-enabled SDK for building graalvm
openjdk-25-source - OpenJDK Development Kit (JDK) source files
openjdk-25-testsupport - Java runtime based on OpenJDK (regression test support)
Now install openjdk latest version,
apt-get install openjdk-25-jre
Output:
root@server:~# apt-get install openjdk-25-jre
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
adwaita-icon-theme alsa-topology-conf alsa-ucm-conf at-spi2-common at-spi2-core ca-certificates-java
dconf-gsettings-backend dconf-service fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-extra
fonts-dejavu-mono gsettings-desktop-schemas gtk-update-icon-cache hicolor-icon-theme java-common libasound2-data
libasound2t64 libatk-bridge2.0-0t64 libatk-wrapper-java libatk-wrapper-java-jni libatk1.0-0t64 libatspi2.0-0t64
libavahi-client3 libavahi-common-data libavahi-common3 libcairo-gobject2 libcairo2 libcloudproviders0 libcolord2
After installation, check the version of JAVA.
java -version
Output:
root@server:~# java -version
openjdk version "25-ea" 2025-09-16
OpenJDK Runtime Environment (build 25-ea+32-Debian-1)
OpenJDK 64-Bit Server VM (build 25-ea+32-Debian-1, mixed mode, sharing)
Install Elasticsearch
Install GnuPG2 Package by running the following command.
apt install -y curl wget gnupg apt-transport-https
Output:
root@server:~# apt-get install gnupg2 -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
dirmngr gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpgconf gpgsm gpgv libassuan9 libgcrypt20
libgpg-error-l10n libgpg-error0 libksba8 libnpth0t64 pinentry-curses
Import GPG key for Elasticsearch packages.
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/elasticsearch.gpg
Next, add the Elasticsearch repository to the system by the following command.
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. Update cache and then install Elasticsearch packages on your system.
apt update
apt install elasticsearch
Output:
root@server:~# apt update
apt install elasticsearch -y
Hit:1 http://deb.debian.org/debian trixie InRelease
Hit:2 http://deb.debian.org/debian trixie-updates InRelease
Hit:3 http://security.debian.org/debian-security trixie-security InRelease
Get:4 https://artifacts.elastic.co/packages/7.x/apt stable InRelease [13.7 kB]
Get:5 https://artifacts.elastic.co/packages/7.x/apt stable/main amd64 Packages [145 kB]
Fetched 158 kB in 0s (401 kB/s)
All packages are up to date.
Installing:
elasticsearch
After installing the Elasticsearch package, Start and enable the elasticsearch service with the following command.
systemctl start elasticsearch.service
systemctl enable elasticsearch.service
Output:
root@server:~# systemctl start elasticsearch.service
systemctl enable elasticsearch.service
Synchronizing state of elasticsearch.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable elasticsearch
Created symlink '/etc/systemd/system/multi-user.target.wants/elasticsearch.service' → '/usr/lib/systemd/system/elasticsearch.service'.
Configure Elasticsearch
Once the elasticsearch has been installed on your system, open the elasticsearch.yml configuration file.
nano /etc/elasticsearch/elasticsearch.yml
Search for the line that contains network.host, uncomment it, and change the value to 0.0.0.0.
Set the network host to 0.0.0.0 to listen on all interfaces and make it available publicly,
network.host: 0.0.0.0
In case you want to configure this to be private/local to your machine.
You will have to set the network.host to 127.0.0.1, so the content is not public.
Add discovery.type: single-node under the discovery section,
discovery.type: single-node
Save and exit the file once modified and restart the Elasticsearch service for the changes to take effect.
systemctl restart elasticsearch
Install and enable firewall using below command,
apt install ufw -y
ufw enable
Output:
Command may disrupt existing SSH connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startup
root@server:~#
Now, allow the port and reload the firewall using the following command.
ufw allow 9200
ufw reload
Output:
root@server:~# ufw allow 9200
Rules updated
Rules updated (v6)
root@server:~# ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startup
root@server:~#
Enter it into your browser to the server hostname or IP address, followed by port #9200
http://<your_server_IP>:9200
You'll get the output like below,


Done!
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS