Install Elasticsearch 5.x on Ubuntu 16.04

Install OpenJDK 8

sudo apt-get install openjdk-8-jdk

Tambahkan gpg key ElasticSearch

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

Install/update transport

sudo apt-get install apt-transport-https

Tambahkan repo

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

Update APT and install ElasticSearch from APT

sudo apt-get update && sudo apt-get install elasticsearch

Reload the daemon

sudo /bin/systemctl daemon-reload

Allow ElasticSearch to start on boot

sudo /bin/systemctl enable elasticsearch.service

Lets fire up ElasticSearch...

sudo systemctl start elasticsearch.service

Lets see if we have some logs

sudo ls -la /var/log/elasticsearch/

Have a look at the logs and make sure that ElasticSearch has properly initiated

sudo cat /var/log/elasticsearch/elasticsearch.log

If logs are looking good, You can CURL the ElasticSearch server

$ curl -XGET 'localhost:9200/?pretty'

The output should be something like this

{

"name" : "c29HHBX",

"cluster_name" : "elasticsearch",

"cluster_uuid" : "LweifnvTSKeP12nRNu0DAg",

"version" : {

"number" : "5.6.10",

"build_hash" : "b727a60",

"build_date" : "2018-06-06T15:48:34.860Z",

"build_snapshot" : false,

"lucene_version" : "6.6.1"

},

"tagline" : "You Know, for Search"

}