This guide assumes that you already installed VirtualBox and Vagrant.
Set up a VirtualBox VM and assign the resources you need (I used precise64 as name), also configure it without the Audio and USB support. In the Network option enable the adapter to “Bridged Adapter” mode and assign the interface you want to use. In the Storage option select the image (iso) of your Ubuntu 12.02 64 Server to the “IDE Controller” and begin the installation according to your needs. If possible name your host as “vagrant”.
Once you installed, you will require to make some changes:
Set your hostname as vagrant
As a generic recommendation use the name vagrant as hostname.
sudo vi /etc/hostname sudo vi /etc/hosts
Add vagrant user and admin group
sudo groupadd admin sudo useradd -G admin -d /home/vagrant -s /bin/bash vagrant sudo passwd vagrant
Edit the sudoers file and add this lines to the file
Defaults env_keep="SSH_AUTH_SOCK" %admin ALL=NOPASSWD: ALL
If you need to use puppet install it now
sudo apt-get install puppet puppetmaster
Install vagrant’s insecure key in the vagrant’s account
mkdir ~/.ssh cd ~/.ssh wget http://github.com/mitchellh/vagrant/raw/master/keys/vagrant wget http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub mv vagrant.pub authorized_keys chmod 0700 ~/.ssh chmod 0640 ~/.ssh/authorized_keys chmod 0640 ~/.ssh/vagrant
Install VirtualBox guest additions
Mount the VirtualBox guest additions and
sudo apt-get install linux-headers-$(uname -r) build-essential mount /dev/cdrom /mnt sudo sh /mnt/VBoxLinuxAdditions.run
Clean your apt’s cache
sudo apt-get clean
Modify the interfaces file
sudo vi /etc/network/interfaces
and add this line to the end of the eth0 configuration interface
pre-up sleep 2
Add the Vagrant’s SSH port
sudo vi /etc/ssh/sshd_config
Add this line after Port 22 declaration
Create your box
Change your position to the path the VirtualBox image is located and create your box.
cd ~/VirtualBox\ VMs/precise64/ vagrant package --base precise64
Add your new box to Vagrant list
vagrant box add precise64 ~/VirtualBox\ VMs/precise64/package.box
Initialize your box
vagrant init precise64
Modify the vagrant configuration file of your box
and add this lines in to Vagrant::Config.run
config.vm.network :bridged config.ssh.host = "vagrant" config.ssh.port = 2222
Start your box
And that’s it, enjoy!