Skip to content

Instantly share code, notes, and snippets.

@erikaheidi
Created December 3, 2015 18:03
Show Gist options
  • Save erikaheidi/899231fbfea21d0daf2b to your computer and use it in GitHub Desktop.
Save erikaheidi/899231fbfea21d0daf2b to your computer and use it in GitHub Desktop.
Simple shell script to install Nginx on CentOS using DigitalOcean's metadata/userdata
#!/bin/bash
yum install epel-release -y
yum install nginx -y
export HOSTNAME=$(curl -s http://169.254.169.254/metadata/v1/hostname)
export PUBLIC_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address)
echo Droplet: $HOSTNAME, IP Address: $PUBLIC_IPV4 > /usr/share/nginx/html/index.html
systemctl enable nginx
systemctl start nginx
@Masterrag
Copy link

``nginx-userdata-centos.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment