AMP AMP

How to install Elasticsearch on Debian 12

To Install Elasticsearch On Debian 12

Introduction:

Elasticsearch is the distributed search and analytics engine within the Elastic Stack allows for the efficient collection, aggregation, and enrichment of data with the assistance of Logstash and Beats. Kibana provides the platform to interactively explore, visualize, and share insights on the data, as well as manage and monitor the entire stack. Elasticsearch serves as the central hub for indexing, searching, and analyzing data effectively.

Procedure:

Step 1: Check the OS version by using following command.

root@linuxhelp:~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Step 2: Install the required packages by using following command.

root@linuxhelp:~# apt install apt-transport-https openjdk-17-jdk -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libc-ares2 libgrpc++1.51 libgrpc29 libprotoc32 libre2-9
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  libice-dev libpthread-stubs0-dev libsm-dev libx11-dev libxau-dev libxcb1-dev
  libxdmcp-dev libxt-dev openjdk-17-jdk-headless x11proto-dev
  xorg-sgml-doctools xtrans-dev
Suggested packages:
  libice-doc libsm-doc libx11-doc libxcb-doc libxt-doc openjdk-17-demo
  openjdk-17-source visualvm
The following NEW packages will be installed:
  apt-transport-https libice-dev libpthread-stubs0-dev libsm-dev libx11-dev
Setting up xorg-sgml-doctools (1:1.11-1.1) ...
Setting up openjdk-17-jdk:amd64 (17.0.11+9-1~deb12u1) ...
update-alternatives: using /usr/lib/jvm/java-17-openjdk-amd64/bin/jconsole to pr
ovide /usr/bin/jconsole (jconsole) in auto mode
Processing triggers for sgml-base (1.31) ...
Setting up x11proto-dev (2022.1-1) ...
Setting up libxau-dev:amd64 (1:1.0.9-1) ...
Setting up libice-dev:amd64 (2:1.0.10-1) ...
Setting up libsm-dev:amd64 (2:1.2.3-1) ...
Processing triggers for man-db (2.11.2-2) ...
Setting up libxdmcp-dev:amd64 (1:1.1.2-3) ...
Setting up libxcb1-dev:amd64 (1.15-1) ...
Setting up libx11-dev:amd64 (2:1.8.4-2+deb12u2) ...
Setting up libxt-dev:amd64 (1:1.2.1-1.1) ...

Step 3: Add the GPG key by using following command.

root@linuxhelp:~# wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK

Step 4: Add Elastic repository by using following command.

root@linuxhelp:~# echo "deb https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list
deb https://artifacts.elastic.co/packages/8.x/apt stable main

Step 5: Update the system packages by using following command.

root@linuxhelp:~# apt update
Get:1 https://artifacts.elastic.co/packages/8.x/apt stable InRelease [10.4 kB]
Hit:2 http://deb.debian.org/debian bookworm InRelease                          
Hit:3 http://security.debian.org/debian-security bookworm-security InRelease   
Hit:4 http://deb.debian.org/debian bookworm-updates InRelease
Get:5 https://artifacts.elastic.co/packages/8.x/apt stable/main amd64 Packages [104 kB]
Fetched 115 kB in 1s (140 kB/s)   
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
130 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: https://artifacts.elastic.co/packages/8.x/apt/dists/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

Step 6: Install Elasticsearch by using following command.

root@linuxhelp:~# apt install elasticsearch
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libc-ares2 libgrpc++1.51 libgrpc29 libprotoc32 libre2-9
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
  elasticsearch
0 upgraded, 1 newly installed, 0 to remove and 130 not upgraded.
Need to get 589 MB of archives.
After this operation, 1,149 MB of additional disk space will be used.
Get:1 https://artifacts.elastic.co/packages/8.x/apt stable/main amd64 elasticsearch amd64 8.14.2 [589 MB]
Fetched 589 MB in 19s (31.7 MB/s)                                              
Selecting previously unselected package elasticsearch.
(Reading database ... 197836 files and directories currently installed.)
Preparing to unpack .../elasticsearch_8.14.2_amd64.deb ...
Creating elasticsearch group... OK
Creating elasticsearch user... OK
Unpacking elasticsearch (8.14.2) ...
Setting up elasticsearch (8.14.2) ...
--------------------------- Security autoconfiguration information -------------
-----------------

Authentication and authorization are enabled.
TLS for the transport and HTTP layers is enabled and configured.

The generated password for the elastic built-in superuser is : z-5L7MVPNmXnSn_RU
v6q

If this node should join an existing cluster, you can reconfigure this with
'/usr/share/elasticsearch/bin/elasticsearch-reconfigure-node --enrollment-token 
<token-here>'
after creating an enrollment token on your existing cluster.

You can complete the following actions at any time:

Reset the password of the elastic built-in superuser with 
'/usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic'.

Generate an enrollment token for Kibana instances with 
 '/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana'.

Generate an enrollment token for Elasticsearch nodes with 
'/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s node'.

--------------------------------------------------------------------------------
-----------------
### NOT starting on installation, please execute the following statements to con
figure elasticsearch service to start automatically using systemd
 sudo systemctl daemon-reload
 sudo systemctl enable elasticsearch.service
### You can start elasticsearch service by executing
 sudo systemctl start elasticsearch.service

Step 7: Reload Daemon by using following command.

root@linuxhelp:~# systemctl daemon-reload

Step 8: Enable Elasticsearch service by using following command.

root@linuxhelp:~# systemctl enable elasticsearch.service
Created symlink /etc/systemd/system/multi-user.target.wants/elasticsearch.service → /lib/systemd/system/elasticsearch.service.

Step 9: Start the Elasticsearch service by using following command.

root@linuxhelp:~# systemctl start elasticsearch.service

Step 10: Check the connection of the Elasticsearch by using following command.

root@linuxhelp:~# curl -X GET "192.168.6.136:9200"
curl: (52) Empty reply from server

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to install Elasticsearch on Debian 12. Your feedback is much welcome.

FAQ
Q
What if I need to change the size of my Elasticsearch cluster at a later time?
A
Scale your clusters both up and down from the user console, whenever you like. The resizing of the cluster is transparently done in the background, and highly available clusters are resized without any downtime. If you scale your cluster down, make sure that the downsized cluster can handle your Elasticsearch memory requirements. Read more about sizing and memory in Sizing Elasticsearch.
Q
Can I try Elasticsearch Service for free?
A
Yes, sign up for a 14-day free trial. The trial starts the moment a cluster is created.
During the free trial period get access to a deployment to explore Elastic solutions for Enterprise Search, Observability, Security, or the latest version of the Elastic Stack.
Q
Can I run the full Elastic Stack in Elasticsearch Service?
A
Many of the products that are part of the Elastic Stack are readily available in Elasticsearch Service, including Elasticsearch, Kibana, plugins, and features such as monitoring and security. Use other Elastic Stack products directly with Elasticsearch Service. For example, both Logstash and Beats can send their data to Elasticsearch Service. What is run is determined by the subscription level.
Q
Is Elasticsearch Service the same as Amazon’s Elasticsearch Service?
A
Elasticsearch Service is not the same as the Amazon Elasticsearch service. To learn more about the differences, check our AWS Elasticsearch Service comparison.
Q
What is Elasticsearch Service?
A
Elasticsearch Service is hosted and managed Elasticsearch and Kibana brought to you by the creators of Elasticsearch. Elasticsearch Service is part of Elastic Cloud and ships with features that you can only get from the company behind Elasticsearch, Kibana, Beats, and Logstash. Elasticsearch is a full text search engine that suits a range of uses, from search on websites to big data analytics and more.