In previous posts, we learned how to use Virtualbox to create a virtual machine, install a guest operating system, and then use the VM as a test server. Now that you know how to make a test server, you might want to know how to run it on a real server without a graphical interface for setup. This will also be useful if you want to start your test server’s VM remotely.
On a Linux system, starting Virtualbox in headless mode is pretty easy. All you need is command-line access and the name of your virtual machine. For example, if your virtual machine is called “CentOS 6” on your graphical installation, that is the exact name you will use for headless mode.
To start your VM in headless mode, type the following command:
$ VBoxHeadless --startvm "[VM Name]"
Replace “VM Name” with the name of your virtual machine. For example:
$ VboxHeadless --startvm "CentOS 6"
The output should look like this:
Oracle VM VirtualBox Headless Interface 4.1.18
(C) 2008-2012 Oracle Corporation
All rights reserved.
VRDE server is listening on port 3389.
To stop your VM, type:
$ VBoxManage controlvm "CentOS 6" poweroff
To pause it, type:
$ VBoxManage controlvm "CentOS 6" pause
To reset it, type:
$ VBoxManage controlvm "CentOS 6" reset
For more information and help with VBoxHeadless, type “VBoxHeadless –help” from the command line.