Skip to content

Instantly share code, notes, and snippets.

@jfryman
Created June 3, 2011 16:40
Show Gist options
  • Save jfryman/1006657 to your computer and use it in GitHub Desktop.
Save jfryman/1006657 to your computer and use it in GitHub Desktop.
# Update the box
apt-get -y update
apt-get -y install linux-headers-$(uname -r) build-essential
apt-get -y install zlib1g-dev libssl-dev libreadline5-dev
apt-get -y install curl unzip
apt-get clean
# Set up sudo
cp /etc/sudoers /etc/sudoers.orig
sed -i -e 's/%sudo ALL=(ALL) ALL/%sudo ALL=NOPASSWD:ALL/g' /etc/sudoers
# Install Ruby from packages
apt-get -y install ruby ruby-dev libopenssl-ruby1.8 irb ri rdoc
# Install Rubygems from source
rg_ver=1.6.2
curl -o /tmp/rubygems-${rg_ver}.zip \
"http://production.cf.rubygems.org/rubygems/rubygems-${rg_ver}.zip"
(cd /tmp && unzip rubygems-${rg_ver}.zip && \
cd rubygems-${rg_ver} && ruby setup.rb --no-format-executable)
rm -rf /tmp/rubygems-${rg_ver} /tmp/rubygems-${rg_ver}.zip
# Install Chef & Puppet
gem install chef --no-ri --no-rdoc
gem install puppet --no-ri --no-rdoc
# Install vagrant keys
mkdir -p /home/vagrant/.ssh
chmod 700 /home/vagrant/.ssh
cd /home/vagrant/.ssh
curl -o /home/vagrant/.ssh/authorized_keys \
'http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub'
chmod 0600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant:vagrant /home/vagrant/.ssh
# Tweak sshd to prevent DNS resolution (speed up logins)
echo 'UseDNS no' >> /etc/ssh/sshd_config
# Customize the message of the day
echo 'Welcome to your Vagrant-built virtual machine.' > /var/run/motd
# The netboot installs the VirtualBox support (old) so we have to remove it
apt-get -y remove virtualbox-ose-guest-dkms
apt-get -y remove virtualbox-ose-guest-utils
yes|sh /mnt/VBoxLinuxAdditions.run
umount /mnt
# Clean up
apt-get -y remove linux-headers-$(uname -r) build-essential
apt-get -y autoremove
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment