Skip to content

Instantly share code, notes, and snippets.

@ncolomer
Created October 7, 2015 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ncolomer/dfcf2ca5026171653561 to your computer and use it in GitHub Desktop.
Save ncolomer/dfcf2ca5026171653561 to your computer and use it in GitHub Desktop.
Install elasticsearch on any Linux
#!/bin/bash
[[ "$UID" -ne "$ROOT_UID" ]] && echo "You must be root to do that!" && exit 1
VERSION=${1:-"1.1.1"}
IP=$(ifconfig eth0 | grep -oP 'inet addr:\K\S+')
apt-get update
apt-get install -y screen unzip wget nmon openjdk-7-jdk
wget -P /tmp https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-${VERSION}.zip
unzip /tmp/elasticsearch-${VERSION}.zip -d /opt
cd /opt/elasticsearch-$VERSION
mkdir -p /mnt/elasticsearch
sed -iE "s|^# path.data:.*$|path.data: /mnt/elasticsearch|" config/elasticsearch.yml
sed -iE "s|^# network.host:.*$|network.host: $IP|" config/elasticsearch.yml
bin/plugin -i mobz/elasticsearch-head
bin/plugin -i elasticsearch/marvel/latest
bin/elasticsearch -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment