Monday, January 9, 2012

Scripted vmdk/ova images w/boxgrinder and virtualbox

It wasn't immediately clear to me from boxgrinder or virtualbox documentation how to script the complete creation of a self-contained runnable virtual image. Since it took me some effort to get it all together, I'll post here a complete example. The script creates a Fedora 16 w/graphical UI machine image by first creating a virtualbox vmdk image (pretty straightforward) and then from that, scripted creation of a more self-contained .ova image (less straightforward).

I have the following packages installed:

  • VirtualBox-OSE
  • rubygem-boxgrinder-build

Starting from a boxgrinder appliance definition file...

http://boxgrinder.org/tutorials/appliance-definition/

...the script creates an .ova image that can be easily imported and used by 3rd parties like this:

  $ VBoxManage import f16-xfce.ova
  $ VirtualBox --startvm f16-xfce