Skip to content

Instantly share code, notes, and snippets.

@EikeDehling
Forked from gourneau/ElasticSearch.sh
Last active May 10, 2017 07:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EikeDehling/e3aeb4d1e0843510fee711aae5bbff95 to your computer and use it in GitHub Desktop.
Save EikeDehling/e3aeb4d1e0843510fee711aae5bbff95 to your computer and use it in GitHub Desktop.
Script to install elasticsearch (Latest 5.x) on a ubuntu machine (16.04LTS)
# Install latest OpenJDK
sudo apt-get update
sudo apt-get install openjdk-8-jre-headless
# Install elastic
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list
sudo apt-get update
sudo apt-get install elasticsearch
# Configure system settings
sudo mkdir -p /etc/systemd/system/elasticsearch.service.d
sudo echo -e "[Service]\nLimitMEMLOCK=infinity" > elasticsearch.conf
sudo sed -i '/-Xms2g/c\-Xms7g' /etc/elasticsearch/jvm.options
sudo sed -i '/-Xmx2g/c\-Xmx7g' /etc/elasticsearch/jvm.options
sudo sed -i '/#bootstrap.memory_lock: true/c\bootstrap.memory_lock: true' /etc/elasticsearch/elasticsearch.yml
# Enable service and start it
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service
# Check service is running
curl http://localhost:9200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment