Skip to content

Instantly share code, notes, and snippets.

@SeonghoonKim
Created December 26, 2012 09:31
Show Gist options
  • Save SeonghoonKim/4379153 to your computer and use it in GitHub Desktop.
Save SeonghoonKim/4379153 to your computer and use it in GitHub Desktop.
elasticsearch install script
#!/bin/bash
INSTALL_ROOT="/opt"
echo "Installing ElasticSearch..."
cd $INSTALL_ROOT
curl -L http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.1.tar.gz | tar -xz
ln -s elasticsearch-0.20.1/ elasticsearch
echo "Installing ElasticSearch service wrapper..."
cd elasticsearch/bin
curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz
mv elasticsearch-elasticsearch-servicewrapper-*/service .
rm -rf elasticsearch-elasticsearch-servicewrapper-*
cd $INSTALL_ROOT
useradd elasticsearch -d $INSTALL_ROOT/elasticsearch -M
chown -R elasticsearch:elasticsearch elasticsearch*
sed -i -e "s|set.default.ES_HOME=<Path to ElasticSearch Home>|set.default.ES_HOME=$INSTALL_ROOT/elasticsearch|" $INSTALL_ROOT/elasticsearch/bin/service/elasticsearch.conf
sed -i -e "s|#RUN_AS_USER=|RUN_AS_USER=elasticsearch|" $INSTALL_ROOT/elasticsearch/bin/service/elasticsearch
echo "Installing init script of ElasticSearch..."
$INSTALL_ROOT/elasticsearch/bin/service/elasticsearch install
echo "Starting ElasticSearch..."
service elasticsearch start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment