Skip to content

Instantly share code, notes, and snippets.

@joshrendek
Created September 24, 2014 02:42
Show Gist options
  • Save joshrendek/85c1c260827785e1e251 to your computer and use it in GitHub Desktop.
Save joshrendek/85c1c260827785e1e251 to your computer and use it in GitHub Desktop.
#!/bin/bash
# This block defines the variables the user of the script needs to input
# when deploying using this script.
#
#
#<UDF name="hostname" label="The hostname for the new Linode.">
# HOSTNAME=
#
#<UDF name="fqdn" label="The new Linode's Fully Qualified Domain Name">
# FQDN=
# This sets the variable $IPADDR to the IP address the new Linode receives.
IPADDR=$(/sbin/ifconfig eth0 | awk '/inet / { print $2 }' | sed 's/addr://')
# This updates the packages on the system from the distribution repositories.
apt-get update
apt-get upgrade -y
echo "upgrades set" >> /root/startup.log
# This section sets the hostname.
echo $HOSTNAME > /etc/hostname
hostname -F /etc/hostname
echo "hostname set" >> /root/startup.log
# This section sets the Fully Qualified Domain Name (FQDN) in the hosts file.
echo $IPADDR $FQDN $HOSTNAME >> /etc/hosts
echo "ip set" >> /root/startup.log
mkdir -p /root/.ssh
echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAo/D28lsrbl+4g6THYsxdkTPdtijM8GNJ1TZ9sBvKqumP83IXnkxHNKvzTeJPPZnMjPc3+iersuubWYV7pUi7No/wv1B/yRTKqbVMjkJ8Xq1vQyaUO4uuiEm4H2oEBu1X3u3lam8IT35Ilz4kbyK3D/3u6GqUqhr7HSS7Y5/ndqRiDU0x6IoRUH/jKeUDIp8lPK8dQ/jDYtqi/lPIgZPkN+RjuNA8HHgXR6tMX1R0pDNvYHr1PFjNJ42SKFJgESzZAlJ/RBeqB36mLpxuXtXVPpqLhJWFrtwJxut9Kz6Ip/fN4z1eVifcdZDcNizRK9lolBq80CRT58Bq2NMuUnhFhQ== joshrendek@josh-rendeks-macbook-pro.local" > /root/.ssh/authorized_keys
echo "finished" > /root/stack.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment