Created
October 11, 2012 00:44
-
-
Save cpliakas/3869462 to your computer and use it in GitHub Desktop.
Vagrant base box script for Ubuntu 12.04
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
#!/bin/sh | |
# curl -L https://bit.ly/vagrant-setup-ubuntu > vagrant-setup.sh | |
# sudo sh vagrant-setup.sh | |
set -e | |
# Add the vagrant user as a password-less sudoer. | |
TMPFILE=$(mktemp) | |
echo "vagrant ALL=(ALL) NOPASSWD: ALL" > $TMPFILE | |
chmod 0440 $TMPFILE | |
mv $TMPFILE /etc/sudoers.d/vagrant | |
/etc/init.d/sudo restart | |
# Install required packages. | |
apt-get update | |
apt-get install -y linux-headers-$(uname -r) build-essential ruby rubygems puppet ssh | |
apt-get dist-upgrade -y | |
# Install required gems. | |
gem install --no-rdoc --no-ri chef | |
apt-get clean | |
# Write script for guest installation. | |
cat <<EOT > install-guest-additions.sh | |
#!/bin/sh | |
# Install the guest additions. | |
mount /dev/cdrom /media/cdrom | |
sh /media/cdrom/VBoxLinuxAdditions.run | |
umount /dev/cdrom | |
EOT | |
# Install the guest additions. | |
chown vagrant.vagrant install-guest-additions.sh | |
chmod 0644 install-guest-additions.sh | |
sh install-guest-additions.sh | |
# Download the insecure vagrant key. | |
SSH_DIR="/home/vagrant/.ssh" | |
KEY_FILE="$SSH_DIR/authorized_keys" | |
mkdir -m 0700 $SSH_DIR && chown vagrant.vagrant $SSH_DIR | |
curl https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub > $KEY_FILE | |
chown vagrant.vagrant $KEY_FILE && chmod 0600 $KEY_FILE | |
# Create directory for shared folders | |
mkdir /vagrant |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment