Building a Vagrant base box

vagrant vewee devops

Jan 2013

As explained in my previous post, Chef allows to develop, test and experiment with computing or cloud infrastructure.

In order to locally build nodes to test the setup of a node, Vagrant is a great automation tool that helps to play with ISO images from a certain operating system. There is a list of ISO images ready for Chef here at Vagrantbox.es. However, a common use case is, that you are running some other Linux version already, or, you want to work with fresh Ubuntu image, that you know what it contains.

So, how to create a new Vagrant basebox?

Here are some steps:

1. Upgrade your VirtualBox to the latest Version

As time of writing this was 4.2.6. This gives you less headache when Vagrant is downloading so called ISO image additions (see e.g. TimeOut issue here )

2. VeeWee and Vagrant;

Make sure you have the gems VeeWee and Vagrant installed:

         gem install vagrant
         gem install veewee

3. List baseboxes

Now, You’ll want to get a list with possible ISO images for baseboxes. This command list baseboxes:

        vagrant basebox templates

4. Define a basebox

As you’ll see in the list you have quite a lot of options. Do a:

     vagrant basebox define Ubuntu-11.04 ubuntu-11.04-server-amd64 -d

5. Check the ISO Image

Check/Edit the definition of the base box. In my case I had to change the pointer to the ISO image in:

    ubuntu-base/definitions/Ubuntu-11.04/definition.rb

6. Build the basebox

Start the build of the basebox:

     vagrant basebox build Ubuntu-11.04

7. Export the basebox:

   vagrant basebox export Ubuntu-11.04

8. Add the basebox:

   vagrant box add 'Ubuntu-11.04' 'Ubuntu-11.04.box'

That’s basically it.

References

Leave me feedback

Follow me on Twitter here.

comments powered by Disqus