#http://adrianbravo.tumblr.com/post/644860401 # 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 # Install the VirtualBox guest additions VBOX_VERSION=$(cat /home/vagrant/.vbox_version) curl -Lo /tmp/VBoxGuestAdditions_$VBOX_VERSION.iso \ "http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso" mount -o loop /tmp/VBoxGuestAdditions_$VBOX_VERSION.iso /mnt yes|sh /mnt/VBoxLinuxAdditions.run umount /mnt # Clean up apt-get -y remove linux-headers-$(uname -r) build-essential apt-get -y autoremove rm /tmp/VBoxGuestAdditions_$VBOX_VERSION.iso exit