Install Java 8
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
Get elastic GPG key
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
Install dependencies
sudo apt-get install apt-transport-https
Add Elasticsearch repository
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
Update APT
sudo apt-get update
Install Elasticsearch
sudo apt-get install elasticsearch
Add update.rc
sudo update-rc.d elasticsearch defaults 95 10
Start server
sudo -i service elasticsearch start
Stop server
sudo -i service elasticsearch stop