phpvirtualbox - Running Virtual Machines With VirtualBox 4.2 and phpvirtualbox On A Headless Ubuntu 12.04 Server

Author: Luis Rodriguez<luis [at] techreanimate[dot] com>

Last edited 06/22/2013

phpvirtualbox is a web-based VirtualBox front-end written in PHP that allows you to access and control remote VirtualBox instances. It tries to resemble the VirtualBox GUI as much as possible to make work with it as easy as possible. It is a nice replacement for the VirtualBox GUI if you run VirtualBox in headless servers. This tutorial explains how to install phpvirtualbox on an Ubuntu 12.04 server to manage a locally installed, headless VirtualBox (version 4.2).


1 Preliminary Note

I have tested this on an Ubuntu 12.04 server (host system) with the IP address where I'm logged in as root.


sudo su


2 Installing VirtualBox

To install VirtualBox 4.2 on our Ubuntu 12.04 server, we open /etc/apt/sources.list...

nano /etc/apt/sources.list

... and add the following line to it:

deb precise contrib

Then we download the VirtualBox public key...

wget -q -O- | apt-key add -

... and update our package database:

apt-get update

Afterwards, we install VirtualBox 4.2 as follows:

apt-get install linux-headers-$(uname -r) build-essential virtualbox-4.2 dkms

(The dkms package ensures that the VirtualBox host kernel modules are properly updated if the Linux kernel version changes.)

Starting with version 4.0, VirtualBox has introduced so called "extension packs" and has outsourced some functionality like remote desktop connection support (VRDP) that was part of VirtualBox packages before version 4.0 into these extension packs. Because we need remote desktop connections to control our virtual machines, we need to install the appropriate extension pack now. Go to, and you will find a link to the following extension pack:

VirtualBox 4.1.18 Oracle VM VirtualBox Extension Pack
Support for USB 2.0 devices, VirtualBox RDP and PXE boot for Intel cards.

Download and install the extension pack as follows:

cd /tmp
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.11-84980.vbox-extpack

(Make sure you grab the latest version from the VirtualBox web site.)

Now we must add the user that will run VirtualBox with password set(vbox in this example) to the vboxusers group:

useradd –d /home/vbox –m vbox

passwd vbox

Type yourpassword twice.

adduser vbox vboxusers

Edit/create virtualbox conf and let's add this user:

nano /etc/default/virtualbox


Now let’s just make sure the service is in startup:

update-rc.d vboxweb-service defaults

/etc/init.d/vboxweb-service start

Install Apache:

apt-get install apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common apache2 apache2-doc apache2-suexec libapache2-mod-php5 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libapr1 php5-common php5-mysql php-pear wget

Download and copy over phpvirtualbox:

cd /tmp



cp phpvirtualbox-4.2-4 /var/www/phpvirtualbox/

Edit php phpvirtualbox conf file and add the user and password:

nano /var/www/phpvirtualbox/config.php

var $username = 'vbox';
var $password = 'your vbox password';

Now you can access phpvirtualbox at

This guide was made using

Share this page:

11 Comment(s)

Add comment


From: Gerrit at: 2013-07-11 13:25:53

When I created the /var/www/phpvirtualbox/config.php with your information I got an AJAX error (couldn't parse it).

 It would be better to update the file /var/www/phpvirtualbox/config.php-example with the username and password, and then save it as the config.php file.

But other than that, it worked great! Thanks.

From: Bas at: 2013-07-25 06:48:47

Thanks to Gerrit it works fine.

The only problem I have is that I can not login with the vbox user only with admin.

From: Anonymous at: 2013-10-25 19:26:50

The vbox user only runs vboxweb-service and is used for the SOAP interaction. To create another user for phpvirtualbox, use the admin panel within the application.

From: Anonymous at: 2013-11-18 21:29:04



I'm confused 

I installed everything, and with some update weblinks (virtualbox 4.3 and  Oracle_VM_VirtualBox_Extension_Pack-4.3.2-90405.vbox-extpack) I think I've got virtualbox up and running.

I can't however login to the phpvirtualbox site. password setting via the  passwd vbox command is set to 'test', also the password in config.php is test, but still I get "Invalid username or password."


Where did my thoughts go in the wrong direction???

From: Gordon at: 2013-09-22 11:18:28

The source files for phpvirtualbox have moved from  Googlecode to Sourceforge. The latest version is located at


From: Anonymous at: 2013-09-24 03:06:46

I think there is a syntax error in the copy command

 cp phpvirtualbox-4.2-4 /var/www/phpvirtualbox/

From: at: 2013-10-15 20:47:24

First of all a nice tutorial. I found a few small mistakes, however which could be fixed. VirtualBox 4.1.18 Oracle VM VirtualBox Extension Pack ---- speaking about the current version. Support for USB 2.0 devices, VirtualBox RDP and PXE boot for Intel cards. Download and install the extension pack as follows: cd /tmp wget ---- speaking about 4.2.12 VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.11-84980.vbox-extpack ---- speaking about 4.2.11 It should be : ---------------------------------------------------------------------- cd /tmp wget VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.18.vbox-extpack

From: Anonymous at: 2013-10-25 19:29:40

If running this on an Ubuntu 12.04 minimal install, unzip is not installed and should be added to the list of packages to retrieve via apt-get while pulling down apache. Also, wget is listed as part of the package list to get with apache, yet is already called for use in step 2 to obtain the repo key.

From: Shane G at: 2013-11-07 17:06:04

I have attempted this setup more than once with less than successful results.  I can hit the server, but the instance of PHPVB is says the site is not found. 

What am I missing? (Aside from experience) :D


From: Shane G at: 2013-11-07 17:09:27

I found my error... 

Mods - please delete :) 


From: Anonymous at: 2013-11-17 03:48:36

Configured everything as per the tutorial. When trying to log in to phpvirtualbox with the username and password provided in config.php I get "Invalid username or password"

 Am I supposed to log in using some other login credentials?

 The server appears to be running:

netstat -plnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0  *               LISTEN      1071/mysqld    
tcp        0      0    *               LISTEN      1241/apache2   
tcp        0      0    *               LISTEN      947/sshd       
tcp        0      0*               LISTEN      1164/vboxwebsrv
tcp6       0      0 :::22                   :::*                    LISTEN      947/sshd