/ Technical / Linux / VirtualBox

VirtualBox on Debian Squeeze

I had been trialing VMware Server as a way to virtualise servers, but rejected it for two reasons. Commercial usage requires a paid for licence and the installation on debian was a complete pain, especially with module rebuilds everytime a new kernel became available. On the other hand VirtualBox has an open source version and is already in the debian repositories.

Installation

aptitude update && aptitude install module-assistant virtualbox-ose
m-a a-i virtualbox-ose-source
modprobe vboxdrv
modprobe vboxnetflt
adduser yourusername vboxusers

To load the vboxdrv and vboxnetflt modules at system startup, edit /etc/default/virtualbox-ose and set LOAD_VBOXDRV_MODULE to 1. Installation instructions based on the Debian Wiki - VirtualBox

I forward X over SSH and run the GUI frontend on my desktop using the command virtualbox. The GUI is a quick and easy way to create your first virtual machine.

Cloning

A VirtualBox VM consists of an XML configuration file and one or more vdi files. You cannot just copy the vdi files using OS level copies as the UUIDs would clash, so you need to use the VBoxManage executable.

VBoxManage clonevdi <SRC> <TRG>

Rather than trying to tweak the XML files manually and then registering the new VM with VirtualBox, it is easier to use the GUI frontend, create a new machine and link it to the cloned disk image.