Import the Elasticsearch PGP Key
Bash
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
You may need to install the apt-transport-https package on Debian before proceeding:
Bash
apt-get install apt-transport-https
For Elasticsearch 5.x on Debian 8
Save the repository definition to /etc/apt/sources.list.d/elastic-5.x.list:
Bash
echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-5.x.list
For Elasticsearch 7.x on Debian 10
Save the repository definition to /etc/apt/sources.list.d/elastic-7.x.list:
Bash
sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'
You can install the Elasticsearch Debian package with:
Bash
apt-get update
apt-get install elasticsearch
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:
Bash
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service --now
Elasticsearch can be started and stopped as follows:
Bash
systemctl start elasticsearch.service
systemctl stop elasticsearch.service
Test started Elasticsearch server by entering http://localhost:9200 in a web browser.
Links
with more detailed information: