VirtualBox Web Interface using phpVirtualBox and Debian 7

Here is a step by step tutorial on how to manage VirtualBox using the phpVirtualBox web interface on Debian 7.

Add VirtualBox package repository to apt source list:

sudo echo "deb http://download.virtualbox.org/virtualbox/debian wheezy contrib" >> /etc/apt/sources.list

Add the public key for this new repository:

wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | apt-key add -

Update the source list:

apt-get update

Install the latest version of VirtualBox:

apt-get install virtualbox-4.3

Create a user for running virtual machines, member of the vboxusers group:

useradd -m -g vboxusers -s /bin/sh virtualbox

Set a password for the user, required by phpVirtualBox:

passwd virtualbox

Enable the VirtualBox Webserver:

sudo echo "VBOXWEB_USER=virtualbox" >> /etc/default/virtualbox

(Re)Start the VirtualBox Webserver:

service vboxweb-service restart

NOTE: A virtualbox configuration file having the only configuration entry above will create a listening server on localhost, port 18083. Further details available here: http://sourceforge.net/p/phpvirtualbox/wiki/vboxweb-service%20Configuration%20in%20Linux/

Download and install the Extension Pack for using the remote desktop feature:

wget http://download.virtualbox.org/virtualbox/4.3.18/Oracle_VM_VirtualBox_Extension_Pack-4.3.18.vbox-extpack
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.18.vbox-extpack
rm Oracle_VM_VirtualBox_Extension_Pack-4.3.18.vbox-extpack

This tutorial assumes Apache / Nginx with PHP are available, and the required JSON and SOAP PHP extensions installed.

Download phpVirtualBox to your virtual hosts’ public directory:

http://downloads.sourceforge.net/project/phpvirtualbox/phpvirtualbox-4.3-1.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fphpvirtualbox%2Ffiles%2F&ts=1413987704&use_mirror=netcologne

Extract archive:

unzip phpVirtualBox.zip

Copy the example file to a configuration file:

cp config.php-example config.php

Edit, and change the following:

var $username = 'virtualbox';
var $password = 'systemuserpassword';

/* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */
var $location = 'http://127.0.0.1:18083/';