Installing a VirtualBox WebGUI with phpVirtualBox

phpVirtualBox is an Ajax based Web GUI for VirtualBox based on the vboxwebsrv protocol included with VirtualBox. The interface is almost identical to the native interface of VirtualBox on a non-headless machine. Through it you can create and manage VM's without ever having to log in to your system. Unfortunately, theres no .deb package to install it, so it takes a bit of command line work, but we'll work through it step by step.

Setting up the vboxweb-service so that phpVirtualbox can connect to it

Before we can install phpVirtualBox, we need to set up the vboxweb-service on our host.

So go ahead and create the file /etc/default/virtualbox:

sudo nano /etc/default/virtualbox

and paste the following into the file:


then save it by pressing [Ctrl-X] and [Y]

make sure that vboxuser has a home directory:

sudo mkdir /home/vboxuser && sudo chown vboxuser:users /home/vboxuser && sudo usermod  --home /home/vboxuser vboxuser

and test that vboxweb-service can now start correctly:

sudo /etc/init.d/vboxweb-service start

if it shows “* done.” then it is configured properly. A failed start will yield a red “*”. If it works properly, go ahead and tell it to start at boot:

sudo update-rc.d -f vboxweb-service remove && sudo update-rc.d vboxweb-service defaults

The first command removes the init settings that don't work, the second adds in new settings that do. From here go ahead and reboot the server, and make sure that the init script successfully started the vboxweb-service at boot:

sudo /etc/init.d/vboxweb-service status

if it says “running”, then everything is working properly, and we can go ahead and install the web server that will host virtualbox, and unzip to unzip the server:>if it says “running”, then everything is working properly, and we can move on to installing the web server

Installing the Basic Web Server and phpVirtualbox

Before we can download phpVirtualBox, we need to install the basic Web Server that will host it, as well as a couple other necessary files:

sudo apt-get install apache2 php5 unzip

Now we can download phpVirtualbox to the web server:

cd /var/www && sudo wget

Now we can unzip it and delete the archive:

sudo unzip *.zip && sudo rm *.zip

rename the directory to something more accessible:

sudo mv phpvirtualbox-4.0-5 phpvirtualbox

go ahead and rename the default config file and open it for editing:

sudo mv /var/www/phpvirtualbox/config.php-example /var/www/phpvirtualbox/config.php
sudo nano /var/www/phpvirtualbox/config.php

make sure these values look like this:

var $username = 'vboxuser';
var $password = 'yourpasswordforvboxuser';

Now you can go ahead and restart the web server:

sudo /etc/init.d/apache2 restart

Now you should be able to access virtualbox by pointing your browser to [hostnameorIPofserver]/phpvirtualbox/ You should see this screen:

Web GUI Login Screen

the default login credentials are username: admin, password: admin. This can be changed from the [preferences → users] menu. Once you've logged in, you'll see the VirtualBox interface Though you probably won't have any VMs:


That's it! Now you can easily Create a Virtual Machine to start working on your Media and LAMP Servers.