Elasticsearch require Java, so first install that. You can install java with the help of Synaptic Package Manager or by:
Add Java PPA to apt:
sudo add-apt-repository -y ppa:webupd8team/java
Update packages:
sudo apt-get update
And then install java:
sudo apt-get -y install oracle-java8-installer
Now java is available on your system, So lets proceed for installing Elasticsearch
Import the Elasticsearch public GPG key into apt:
wget -O - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | sudo apt-key add -
It may ask for password for executing sudo command.
Create the Elasticsearch source list:
echo 'deb http://packages.elasticsearch.org/elasticsearch/1.4/debian stable main' | sudo tee /etc/apt/sources.list.d/elasticsearch.list
Update packages:
sudo apt-get update
And then install Elasticsearch:
sudo apt-get -y install elasticsearch=1.4.4
Now Elasticsearch is installed. To restrict the access only to local system add a line to your configuration file elasticsearch.yml.
sudo vi /etc/elasticsearch/elasticsearch.yml
and then uncomment the network.host option and replace it with:
network.host: localhost
Start elasticsearch by:
sudo service elasticsearch start
If you want to start elasticsearch on bootup then execute:
sudo update-rc.d elasticsearch defaults 95 10