Created
July 17, 2012 06:22
-
-
Save aidansteele/3127571 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup sudo to allow no-password sudo for "admin" | |
groupadd -r admin | |
usermod -a -G admin vagrant | |
cp /etc/sudoers /etc/sudoers.orig | |
sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=admin' /etc/sudoers | |
sed -i -e 's/%admin ALL=(ALL) ALL/%admin ALL=NOPASSWD:ALL/g' /etc/sudoers | |
# Install NFS client | |
apt-get -y install nfs-common | |
# Install Ruby from source in /opt so that users of Vagrant | |
# can install their own Rubies using packages or however. | |
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz | |
tar xvzf ruby-1.9.2-p290.tar.gz | |
cd ruby-1.9.2-p290 | |
./configure --prefix=/opt/ruby | |
make | |
make install | |
cd .. | |
rm -rf ruby-1.9.2-p290 | |
# Install RubyGems 1.7.2 | |
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.11.tgz | |
tar xzf rubygems-1.8.11.tgz | |
cd rubygems-1.8.11 | |
/opt/ruby/bin/ruby setup.rb | |
cd .. | |
rm -rf rubygems-1.8.11 | |
# Installing chef & Puppet | |
/opt/ruby/bin/gem install chef --no-ri --no-rdoc | |
/opt/ruby/bin/gem install puppet --no-ri --no-rdoc | |
# Add /opt/ruby/bin to the global path as the last resort so | |
# Ruby, RubyGems, and Chef/Puppet are visible | |
echo 'PATH=$PATH:/opt/ruby/bin/'> /etc/profile.d/vagrantruby.sh | |
# Installing vagrant keys | |
mkdir /home/vagrant/.ssh | |
chmod 700 /home/vagrant/.ssh | |
cd /home/vagrant/.ssh | |
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys | |
chmod 600 /home/vagrant/.ssh/authorized_keys | |
chown -R vagrant /home/vagrant/.ssh | |
# Remove items used for building, since they aren't needed anymore | |
apt-get -y remove linux-headers-$(uname -r) build-essential | |
apt-get -y autoremove | |
# Zero out the free space to save space in the final image: | |
dd if=/dev/zero of=/EMPTY bs=1M | |
rm -f /EMPTY | |
# Removing leftover leases and persistent rules | |
echo "cleaning up dhcp leases" | |
rm /var/lib/dhcp3/* | |
# Make sure Udev doesn't block our network | |
# http://6.ptmc.org/?p=164 | |
echo "cleaning up udev rules" | |
rm /etc/udev/rules.d/70-persistent-net.rules | |
mkdir /etc/udev/rules.d/70-persistent-net.rules | |
rm -rf /dev/.udev/ | |
rm /lib/udev/rules.d/75-persistent-net-generator.rules | |
echo "Adding a 2 sec delay to the interface up, to make the dhclient happy" | |
echo "pre-up sleep 2" >> /etc/network/interfaces | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment