VMware Server for Linux was great back in the day. Unfortunately it was discontinued and I’ve been searching for a headless VM manager for running and remotely managing virtual machines on Linux ever since.
VirtualBox seems the best solution for the task so far, as it is capable of running headless on Linux and has an (unofficial but good) web interface to manage it.
Start by adding the VirtualBox repositories in CentOS:
Make sure dkms and kernel-devel are installed (as they will be needed for module compilation):
yum install dkms kernel-devel
In some weird instances (you haven’t updated in a long while and a new kernel has been released in the meantime), you will get a different kernel-devel version than the running one, causing VirtualBox installation to fail at compiling the needed modules.
To solve this, either reboot the server to activate the latest kernel or, if some weird instance compels you to use the older kernel, manually download and install it’s headers from the CentOS Vault (replace the version in the link with your own release and architecture):
You can now move on with the installation
yum install VirtualBox-4.3
If you’re reading this far into the future, you’ll most likely install a newer version…
Once done, double check that you did not get any module compilation errors; these steps should return OKs:
Trying to register the VirtualBox kernel modules using DKMS [ OK ]
Starting VirtualBox kernel modules [ OK ]
Add all users which will be using VirtualBox to the vboxusers group:
usermod -a -G vboxusers user1
usermod -a -G vboxusers user2
Set up VirtualBox’s web service by creating the /etc/default/virtualbox file with the following content:
Then start the web service with:
service vboxweb-service start
Set it to run at boot with
chkconfig vboxweb-service on
Set up phpVirtualBox
phpVirtualBox requires the php-soap module, so make sure to install it:
yum install php-soap
Grab phpVirtualBox from http://sourceforge.net/projects/phpvirtualbox/ and extract it to your preferred location (you should already have a webserver on the system running and serving content).
Rename phpVirtualBox’s config.php-sample to config.php and edit it to add one of the administration users:
/* Username / Password for system user that runs VirtualBox */
var $username = 'user1';
var $password = 'randomuser1pass';
/* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */
var $location = 'http://127.0.0.1:18083/';
and log in (default login is admin / admin).
If all went well so far, you’ll be greeted by the administration interface
Install Extensions Pack
Some features (like USB support, clipboard sharing, shared folders and video acceleration) require the Extensions Pack. To install it, first find out the exact version of VirtualBox you are using:
then download the appropriate version of the pack from http://download.virtualbox.org/virtualbox/
Last step is to install it, using:
vboxmanage extpack install <.vbox-extpack file>
If you notice that phpVirtualBox stops communicating after a while with vboxwebsrv which outputs
SQPmp #### SOAP FAULT: Too many open files [SOAP-ENV:Server]
take a look at this support ticket and try the suggested solution:
authconfig --disablefingerprint --update
If logins on a new phpVirtualbox / VirtualBox setup fail with
Error logging in to vboxwebsrv.
Make sure selinux is not blockign the connection by adding the necessary permissions:
yum install -y policycoreutils-python
semanage port -a -t http_port_t -p tcp 18083