Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sarahhenderson/10a6abdfc54ca7ba5c2b to your computer and use it in GitHub Desktop.
Save sarahhenderson/10a6abdfc54ca7ba5c2b to your computer and use it in GitHub Desktop.
Instructions to create a vagrant base box for Ubuntu server 14.04
  1. Download ubuntu from http://www.ubuntu.com/download/server (I used Trusty Tahr 14.04 LTS)
  2. Create a new VM in VirtualBox
  • 512MB RAM
  • Expandable MKVD disk up to 10GB
  1. Install Ubuntu in the VirtualBox
  • Root password: vagrant
  • Username: vagrant, password: vagrant
  • Mount the Guest Additions DVD in VirtualBox UI

Notes: Host setup was done on a Windows 7 host machine using Powershell.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install dkms build-essential linux-headers-generic
sudo mount /dev/cdrom /media/cdrom
sudo /media/cdrom/VBoxLinuxAdditions.run
sudo umount /media/cdrom
sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
sudo /etc/init.d/vboxadd setup
sudo apt-get clean
sudo reboot -h now
sudo su
visudo
# Add the following line to the end of the file.
vagrant ALL=(ALL) NOPASSWD:ALL
# Ctrl-O, [enter], Ctrl-X to exit nano
exit # To exit su mode
mkdir -p /home/vagrant/.ssh
wget --no-check-certificate https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub -O /home/vagrant/.ssh/authorized_keys
chmod 0700 /home/vagrant/.ssh
chmod 0600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant /home/vagrant/.ssh
sudo apt-get install openssh-server
sudo nano /etc/ssh/sshd_config
# Uncomment the following line
AuthorizedKeysFile %h/.ssh/authorized_keys
# Add the following line
UseDNS no
# Ctrl-O, [enter], Ctrl-X to exit nano
# Free up some space
sudo dd if=/dev/zero of=/EMPTY bs=1M
sudo rm -f /EMPTY
sudo shutdown -h now
# On host machine
vagrant package –-base trusty-vagrant-base
# trusty-vagrant-base is the name of my VirtualBox VM
# this will create package.box
vagrant box add trusty64 file://package.box
cd <where-you-want-your-vagrantfile>
vagrant init trusty64
vagrant up
vagrant ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment