Elasticsearch 2.x.x

nano ~/elasticsearch-install.sh

#!/usr/bin/sh
 
VERSION=2.4.0
 
apt-get install openjdk-8-jdk
rm /etc/alternatives/java
ln -s /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java /etc/alternatives/java
 
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
 
if [ ! -f elasticsearch-$VERSION.deb ]; then
  wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/$VERSION/elasticsearch-$VERSION.deb
fi
 
sudo dpkg -i elasticsearch-$VERSION.deb
 
# be sure you add "action.disable_delete_all_indices" : true to the config!!
 
# start script
sudo /etc/init.d/elasticsearch restart
 
if [ -f /usr/bin/plugin ]; then
  rm /usr/bin/plugin
fi
 
sudo ln -s /usr/share/elasticsearch/bin/plugin /usr/bin/plugin
 
# ------------------------------------------------------------------------------------
 
# if you want to remove it:
#sudo dpkg -r elasticsearch
 
# binaries & plugin
#/usr/share/elasticsearch/bin
 
# log dir
#/var/log/elasticsearch
 
# data dir
#/var/lib/elasticsearch
 
# config dir
#/etc/elasticsearch
 
# prepare ElasticSearch UI
#sudo apt-get install apache2
#sudo mkdir /var/www/ui
#sudo chown -R ubuntu.www-data /var/www
# now copy ES-HEAD to /var/www/ui