Skip to content

Instantly share code, notes, and snippets.

@killtw
Created April 15, 2014 08:02
Show Gist options
  • Save killtw/10712167 to your computer and use it in GitHub Desktop.
Save killtw/10712167 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
echo ">>> Installing Elasticsearch"
# Set some variables
ELASTICSEARCH_VERSION="$1" # Check http://www.elasticsearch.org/download/ for latest version
# Install prerequisite: Java
sudo apt-get install -y openjdk-7-jre-headless
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-$ELASTICSEARCH_VERSION.deb
sudo dpkg -i elasticsearch-$ELASTICSEARCH_VERSION.deb
rm elasticsearch-$ELASTICSEARCH_VERSION.deb
# Configure Elasticsearch for development purposes (1 shard/no replicas, don't allow it to swap at all if it can run without swapping)
sudo sed -i "s/# index.number_of_shards: 1/index.number_of_shards: 1/" /etc/elasticsearch/elasticsearch.yml
sudo sed -i "s/# index.number_of_replicas: 0/index.number_of_replicas: 0/" /etc/elasticsearch/elasticsearch.yml
sudo sed -i "s/# bootstrap.mlockall: true/bootstrap.mlockall: true/" /etc/elasticsearch/elasticsearch.yml
sudo service elasticsearch restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment