off the stack

Vagrant and veewee for development sandboxing


based on vagrant 1.0.5, veewee 0.3.1 and VirtualBox 4.2

As I am always looking for tools to simplify my work and play and was looking for some virtualization helpers to easily manage virtual machines for development I thought I should pick vagrant from my to-do list and give it a try.

Since I looked at it for the first time quite some time has gone by and the project grew and matured as it seems and the user-base contains some large companies as it seems - which is nice IMHO.

Of course I could also stick with already packaged boxes but that would be too easy I guess. Furthermore I am likely to need custom boxes anyway further down the road. So I was looking for ways to build custom boxes too.

Quickly veewee showed up - which is a tool for generating vagrant boxes.

So here we go.

Installing the software I think I need

According to the vagrant docs and the veewee readme I will need some software installed on my (64bit debian squeeze) system for this to work.

Mind the prompts. # stands for root and $ for a normal user.

Installing virtualbox

~# cat > /etc/apt/sources.list.d/oracle-virtualbox.list << EOF
deb squeeze non-free
deb squeeze contrib
~# wget -q -O- | sudo apt-key add -
~# apt-get update
~# apt-get install dkms
~# apt-get install virtualbox-4.2

Note that eventually a relogin/reboot and/or adding a user to the virtualbox group will be needed to have correct permissions to actually use virtualbox.

Installing vagrant (using the appropriate download from vagrant downloads):

~# wget -c
~# dpkg -i vagrant_1.0.5_x86_64.deb
~# echo 'export PATH=$PATH:/opt/vagrant/bin' >> /etc/profile.d/
~# . /etc/profile.d/

Maybe some other packages will be needed for installation...

And then veewee:

~# apt-get install libxslt1-dev libxml2-dev zlib1g-dev
~$ bash -s stable < <(curl -s
~$ . ~/.bash_profile
~$ rvm install 1.9.2
~$ git clone
~$ cd veewee
~/veewee$ gem install bundler
~/veewee$ bundle install

Note that the RVM install will probably need some extra packages. So just read and follow the instructions when they come up.

Building an image

Veewee comes with quite a few "templates" to choose from in order to build your vms. Take a look. I chose a debian image with reasonably low memory requirements for now.

~/veewee$ veewee vbox define 'debian-6-i386' 'Debian-6.0.6-i386-netboot'
~/veewee$ veewee vbox build 'debian-6-i386'

That took some time (~10 minutes) ... but now I got a virtual machine up and running based on the given veewee template.

Veewee tells me that I can login to the vm with:

~/veewee$ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 7222 -l vagrant
vagrant@'s password: vagrant

Which works. Now I verify the build.

~/veewee$ veewee vbox validate 'debian-6-i386'

Which runs some cucumber tests which are all green here.

Now I only have to create a box file from this...

Setting up a box

When veewee is active, vagrant provides an additional command named basebox which actually does this. After that I can add it to vagrant, initialize and start it.

~/veewee$ vagrant basebox export 'debian-6-i386'
~/veewee$ vagrant box add 'debian-6-i386' ''
~/veewee$ vagrant init 'debian-6-i386'
~/veewee$ vagrant up

Which takes a few minutes ...

... and hangs. Looking around revealed a known issue.

So I opened up the Vagrantfile in question and added config.ssh.timeout = 20 to the configuration directives. Running vagrant up again resulted in a properly started vm which I then can ssh into using

~/veewee$ vagrant ssh


~/veewee$ vagrant down