Command line VirtualBox

I’m a big fan of Oracle’s VirtualBox virtualization software.  I’ve run it on my home laptop for quite some time but recently started running it on server class hardware with CentOS as the host OS.  Running it on my laptop is a snap because I can create and manage guest machines using a GUI.  However, running VirtualBox on a server class machine with no available window manager means no access to a GUI.  Fortunately, VirtualBox has a set of command line tools that allow for the creation and management of guest machines.

VBoxManage is the command that allows you to fully control VirtualBox from the command line.  The command has an extensive option list so your best bet is to have a look at Chapter 8 of the VirtualBox manual.  After creating a virtual host, you can start it up via the VBoxHeadless command.  For example, if I created a Linux Mint 13 virtual host called LM13, I would start it using the following command:

VBoxHeadless -startvm “LM13”

In addition to starting up the virtual host, the command also launches a VirtualBox Remote Desktop Extension (VRDE) server.  This server allows you to connect to your newly started machine via RDP using a tool such as Remote Desktop on Windows or rdesktop on Linux.  You can run multiple instances of the VRDE server but you must have each one listen on a different port.  You can specify the port number using the -vrdeproperty flag:

VBoxHeadless -startvm “Ubuntu 12.04” -vrdeproperty “TCP/Ports”=3390

This causes a second server to be started listening on TCP port 3390.

One curiosity of the VirtualBox command set is it’s verbosity and use of mixed-case.  I find myself not remembering exact command strings due to the structure of the commands.  You can see an example of this in the above command with the use of the “TCP/Ports” property name.  Maybe I’m old school but I would prefer if the command set were more succinct.


This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *