Skip to content

Instantly share code, notes, and snippets.

@luizamboni
Last active October 27, 2016 16:35
Show Gist options
  • Save luizamboni/3a69b231d43979f29f46a0b8d4c1f507 to your computer and use it in GitHub Desktop.
Save luizamboni/3a69b231d43979f29f46a0b8d4c1f507 to your computer and use it in GitHub Desktop.
create a digitalocean droplet with elasticsearch enabled to listen private network
#!/bin/sh
export PRIVATEADDRS=$(curl -s http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address)
apt-get update
sudo apt-get install default-jre -y
wget -O /tmp/es https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.4.1/elasticsearch-2.4.1.deb
sudo dpkg -i /tmp/es
sudo echo "network.host: $PRIVATEADDRS" >> /etc/elasticsearch/elasticsearch.yml
sudo systemctl enable elasticsearch.service
sudo service elasticsearch restart
dd if=/dev/zero of=/var/swap bs=512 count=2097152
mkswap /var/swap
chmod 0600 /var/swap
swapon /var/swap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment