7.12.10

Headless-only Virtualbox

Virtualbox is a versatile virtualization solution. That is, many virtual machines can be hosted on a single physical computer. This software is well supported under Linux, download and installation instructions for the binary package can be found here. Interestingly, although virtualization comes especially handy in server environments, Virtualbox demands most of the X-Windows system to be installed as a package dependency, even though command line operation and Remote Display (VRDP) as output device is supported in headless mode meaning that the graphic output of the guest operating system can be viewed with a RDP software such as Windows' built-in Remote Desktop Connection.
Luckily enough, such package dependencies can be circumvented, saving the system several hundreds of MBs of unnecessary packages at the expense of loosing all local graphic capabilities. But if you do not plan to install and use X anyways, then this will not be a problem.
The steps below are based on forum posts here and here. I however had to update those instructions to be useful for the current version 3.2. As usual, a Debian-based distribution is assumed, yet the adaption should be straightforward to other distributions as well.
Download the appropiate package from here and save it to ~/virtualbox/virtualbox.deb. Then:

#: cd virtualbox
#: dpkg --extract virtualbox.deb original
#: dpkg --control virtualbox.deb original/DEBIAN

Now we have the extracted package along with the dependency information in original/DEBIAN/control.
First we delete unnecessary files and dirs from the package:

#: rm -rf usr/lib/virtualbox/sdk usr/lib/virtualbox/VirtualBox usr/lib/virtualbox/VirtualBox.so usr/lib/virtualbox/VBoxSDL usr/lib/virtualbox/VBoxSDL.so usr/bin/VirtualBox usr/bin/VirtualBox.so usr/bin/VBoxSDL usr/lib/virtualbox/libQtGuiVBox.so.4

Now, resolving the dependency issue, the content of the original/DEBIAN/control has to be altered. The important part here is the part starting with "Depends:" where plenty of packages reside. For command line operation, only the following are necessary:

Depends: libc6 (>= 2.6), libcurl3-gnutls (>= 7.16.2-1), libgcc1 (>= 1:4.1.1), libssl0.9.8 (>= 0.9.8m-1), libstdc++6 (>= 4.4.0), libxml2 (>= 2.7.4), psmisc, adduser

Save the file, and the package is ready to be repacked and installed:
#: dpkg --build ~/virtualbox/original ~/virtualbox/repacked.deb
#: dpkg --install ~/virtualbox/repacked.deb

Note that after such a reconfiguration only VBoxHeadless can be used to start the virtual machines, and they can be configured using the VBoxManage command line tool.