Skip to content

Instantly share code, notes, and snippets.

@bitsandbooks
Created June 22, 2014 17:47
Show Gist options
  • Save bitsandbooks/c35cf41b34e87863d0af to your computer and use it in GitHub Desktop.
Save bitsandbooks/c35cf41b34e87863d0af to your computer and use it in GitHub Desktop.
Basic setup script for a fresh Ubuntu server. Will set the machine's hostname and install Git, Puppet (with APT module) and ZFS.
#!/usr/bin/env bash
# Basic setup script for a fresh Ubuntu machine. Will set the machine's
# hostname and install Git, Puppet and ZFS.
RELEASE=`lsb_release -s -c`
NAME="servername"
# Set the machine's hostname. If you pass a name as $1, that hostname
# will be used. Otherwise, just change the $NAME variable above.
if [ -n "$1" ]; then; unset $NAME && NAME=$1; fi
hostname $NAME
echo $NAME > /etc/hostname
echo "127.0.0.1 localhost
>127.0.0.1 ${NAME}.local ${NAME}
>
> # The following lines are desirable for IPv6 capable hosts
> ::1 localhost ip6-localhost ip6-loopback
> ff02::1 ip6-allnodes
> ff02::2 ip6-allrouters" > /etc/hosts
# Get Puppet metapackage.
wget http://apt.puppetlabs.com/puppetlabs-release-$RELEASE.deb
dpkg -i puppetlabs-release-$RELEASE.deb
rm puppetlabs-release-$RELEASE.deb
# Add the ZFS on Linux APT repository.
add-apt-repository ppa:zfs-native/stable
# Refresh APT cache and upgrade currently installed packages.
apt-get update && apt-get -y upgrade
# Install packages and Puppet APT module.
apt-get install -y git
apt-get install -y puppet puppet-common && puppet module install puppetlabs/apt
apt-get install -y ubuntu-zfs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment