Install Elasticsearch with Debian Package

Yarpii

🖤 Founder
Dec 6, 2019
109
1
18
Bitz
💎2,551.78

Installing from the APT repository
Download and install the public signing key:
Bash:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
You may need to install the apt-transport-https package on Debian before proceeding:
Bash:
apt install apt-transport-https
Save the repository definition to /etc/apt/sources.list.d/elastic-7.x.list:
Bash:
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | tee /etc/apt/sources.list.d/elastic-7.x.list

These instructions do not use add-apt-repository for several reasons:
  1. add-apt-repository adds entries to the system /etc/apt/sources.list file rather than a clean per-repository file in /etc/apt/sources.list.d
  2. add-apt-repository is not part of the default install on many distributions and requires a number of non-default dependencies.
  3. Older versions of add-apt-repository always add a deb-src entry which will cause errors because we do not provide a source package. If you have added the deb-src entry, you will see an error like the following until you delete the deb-src line:
    Unable to find expected entry 'main/source/Sources' in Release file
    (Wrong sources.list entry or malformed file)

You can install the Elasticsearch Debian package with:
Bash:
apt update && apt install elasticsearch

Running Elasticsearch with systemd
To configure Elasticsearch to start automatically when the system boots up, run the following commands:
Bash:
/bin/systemctl daemon-reload
Bash:
/bin/systemctl enable elasticsearch.service
Elasticsearch can be started and stopped as follows:
  • Start your elasticsearch
    Bash:
    systemctl start elasticsearch.service
  • Stop your elasticsearch
    Bash:
    systemctl stop elasticsearch.service
  • Check Status
    Bash:
    systemctl status elasticsearch.service
 
Last edited: