learn by doing

VirtualBox Web Interface

I am personally using VirtualBox as a virtualization solution as it fits my needs and it integrates well with Ubuntu. I recently found that you can set up a web interface and manage Virtualbox through it. In the following article I’ll describe how you can set up the web interface for VirtualBox using phpVirtualBox and I’d also like to thank the developers for doing this great job.

Firstly as with any web interface a web server is required so you’ll need to install apache web server with php support :

root@localhost#apt-get install apache2 php5 libapache2-mod-php5

After this you’ll have a fully working webserver with php support having its root directory into /var/www/

Now we will need to install VirtualBox. I prefer using the latest version so we’ll install VirtualBox 4.1

root@localhost#apt-get install virtualbox-4.1

phpVirtualBox requires vboxwebserv service to run so you’ll have to run the following command:

root@localhost#vboxwebsrv -b --host {ip_address} --port 18083
b: background
host: the ip address of the interface used by the server to listen 
port: the port used  by the server

Download phpVirtualBox and move it to you web server’s root

root@localhost#mv phpvirtualbox-4.1-5 /var/www/vbox 
root@localhost#cd /var/www/vbox

Edit the config.php file by modifying the following variables to match your system’s:

root@localhost#vim config.php
 /* Username / Password for system user that runs VirtualBox */
 var $username = ‘vbox’;
 var $password = ‘your-password’;
 var $location = ‘http://{ip_address}:18083/’;

And now you should have an accessible web interface for your VirtualBox which can be accessed at http://{ip_address}/vbox. The default username and password are admin/admin.

In order to access the VMs consoles through the web interface you have to install the VirtualBox Extension Pack and set the display settings to activate the remote display.