Create a gist now

Instantly share code, notes, and snippets.

@nefarioustim /postinstall.sh Secret
Last active Oct 1, 2015

Post install for Ubuntu 13.10 base box
# http://git.io/n4OFcg
date > /etc/vagrant_box_build_time
echo 'ubuntu-saucy.vagrant' > /etc/hostname
echo '127.0.0.1 ubuntu-saucy.vagrant' >> /etc/hosts
start hostname
apt-get -y update
apt-get -y upgrade
apt-get -y install linux-headers-$(uname -r) build-essential
apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev
apt-get -y install vim
apt-get -y install dkms
apt-get -y install nfs-common
apt-get clean
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
cd /tmp
wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
tar -xvzf ruby-2.0.0-p247.tar.gz
cd ruby-2.0.0-p247/
./configure --prefix=/usr/local
make
make install
gem install chef puppet ruby-shadow --no-ri --no-rdoc
# Installing vagrant keys
mkdir -m700 /home/vagrant/.ssh && cd $_
wget --no-check-certificate 'http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub' -O authorized_keys
chmod 600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant /home/vagrant/.ssh
echo 'UseDNS no' >> /etc/ssh/sshd_config
# Installing the virtualbox guest additions
VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
cd /tmp
wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
sh /mnt/VBoxLinuxAdditions.run
umount /mnt
rm VBoxGuestAdditions_$VBOX_VERSION.iso
apt-get -y autoremove
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY
echo "cleaning up dhcp leases"
rm /var/lib/dhcp/*
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 "pre-up sleep 2" >> /etc/network/interfaces
exit
@davidwinter

Thanks for this. Also found that the mime-types gem is throwing the following error:

Invalid gemspec in [/var/lib/gems/1.8/specifications/mime-types-1.18.gemspec]: invalid date format in specification: "2012-03-21 00:00:00.000000000Z"

Suggest that it's added along with the json gem spec removal?

@nefarioustim
Owner

Thanks for the heads-up! :)

I assume the latest mime-types gemspec fixes the issue? In which case you'll need to force install of the mime-types gem 'cos the dependancy will still be the broken one. When I get chance, I'll test the gems and stick in a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment