Objective
The objective is to provide you with a simple to follow steps on how to install Elasticsearch on Debian Linux. The guide does not delve into Elasticsearch configuration as this is a tale for another time.
Operating System and Software Versions
- Operating System: – Debian 9 (Stretch)
- Software: – Elasticsearch 5.2.0
Requirements
Privileged access to your Debian system will be required
Difficulty
EASY
Conventions
- # – requires given linux commands to be executed with root privileges either directly as a root user or by use of
sudo
command - $ – requires given linux commands to be executed as a regular non-privileged user
Instructions
Prerequisites installation
To begin, install all required prerequisites listed below. The net-tools
package is optional and is used for testing purposes only.
# apt update # apt install openjdk-8-jdk-headless net-tools wget
Download Elasticsearch
At this stage, we need to download the Elasticsearch Debian package. At the time of writing, only Elasticsearch 5.2 is available. Feel free to replace the below link with version 6.0 download URL if it is available.
wget --no-check-certificate https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.2.0.deb
Install Elasticsearch
Use dpkg
command to install the previously downloaded elasticsearch-5.2.0.deb
:
# dpkg -i elasticsearch-5.2.0.deb
Start and Enable Elasticsearch
Tos start and enable Elasticsearch on Debian systemd system execute:
# systemctl start elasticsearch # systemctl enable elasticsearch
Confirm Installation
The journalctl
command should now list Elasticsearch as started:
# journalctl | tail Feb 11 08:59:02 linuxconfig systemd[1]: Reached target Network is Online. Feb 11 08:59:02 linuxconfig systemd[1]: Starting Elasticsearch... Feb 11 08:59:02 linuxconfig systemd[1]: Started Elasticsearch.
Elasticsearch by default listens on localhost only unless defined differently within /etc/elasticsearch/elasticsearch.yml
:
# netstat -ntlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 403/sshd tcp6 0 0 127.0.0.1:9200 :::* LISTEN 5562/java tcp6 0 0 ::1:9200 :::* LISTEN 5562/java tcp6 0 0 127.0.0.1:9300 :::* LISTEN 5562/java tcp6 0 0 ::1:9300 :::* LISTEN 5562/java tcp6 0 0 :::22 :::* LISTEN 403/sshd
Elasticgsearch is now available under localhost:9200
URL:
# wget -qO - 127.0.0.1:9200 { "name" : "p7g80HJ", "cluster_name" : "elasticsearch", "cluster_uuid" : "W7iE1jWYSiWL-hG3zMsaFQ", "version" : { "number" : "5.2.0", "build_hash" : "24e05b9", "build_date" : "2017-01-24T19:52:35.800Z", "build_snapshot" : false, "lucene_version" : "6.4.0" }, "tagline" : "You Know, for Search" }
Install Plugins
Elasticsearch plugin and other relevant binaries are locate under /usr/share/elasticsearch/bin/
directory. Add this directory to your executable PATH
:
# export PATH=$PATH:/usr/share/elasticsearch/bin/
To install new Elasticsearch plugins use elasticsearch-plugin
command. For example to install “file-based discovery plugin” run:
# elasticsearch-plugin install discovery-file -> Downloading discovery-file from elastic [=================================================] 100% -> Installed discovery-file