Import the Elasticsearch PGP Key

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

You may need to install the apt-transport-https package on Debian before proceeding:

apt-get install apt-transport-https
BASH

For Elasticsearch 5.x on Debian 8

Save the repository definition to /etc/apt/sources.list.d/elastic-5.x.list:

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

For Elasticsearch 7.x on Debian 10

Save the repository definition to /etc/apt/sources.list.d/elastic-7.x.list:

sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'
BASH


You can install the Elasticsearch Debian package with:

apt-get update
apt-get install elasticsearch
BASH

Installing Elasticsearch through packet manager will only allow to start it as service, not manually!

To configure Elasticsearch to start automatically when the system boots up, run the following commands:

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service --now
BASH

Elasticsearch can be started and stopped as follows:

systemctl start elasticsearch.service
systemctl stop elasticsearch.service
BASH
Test started Elasticsearch server by entering http://localhost:9200 in a web browser.

with more detailed information: