VirtualBox 4.2 and phpVirtualBox on Debian

With this tutorial we are going to explain how to install VirtualBox 4.2 and phpVirtualBox for remote management on Debian Linux.

Installing VirtualBox 4.2

We need to add the Debian repository for add the public key and install VirtualBox 4.2

vi /etc/apt/sources.list
deb squeeze contrib non-free

Run the following commands:

wget -q -O- | apt-key add -
apt-get update
apt-get install virtualbox-4.2

For different versions of Debian you can use the following repositories

deb precise contrib
deb oneiric contrib
deb natty contrib
deb maverick contrib non-free
deb lucid contrib non-free
deb karmic contrib non-free
deb hardy contrib non-free
deb wheezy contrib
deb squeeze contrib non-free
deb lenny contrib non-free

Now we need to install VirtualBox Extension Pack

cd /tmp
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.0-80737.vbox-extpack

We need to create vbox user for VirtualBox and phpVirtualBox and add it to vboxusers group

useradd -d /home/vbox -m -g vboxusers -s /bin/bash vbox
passwd vbox

Create the file /etc/default/virtualbox and put the following lines so that the VirtualBox SOAP API which is called vboxwebsrv runs as the user vbox

vi /etc/default/virtualbox

Next we need to set vboxweb-service to start on boot

update-rc.d vboxweb-service defaults
/etc/init.d/vboxweb-service start

Installing phpVirtualBox

We are going to install nginx and PHP to support phpVirtualBox

apt-get install nginx php5-common php5-mysql php5-suhosin php5-fpm php-pear unzip
/etc/init.d/nginx start

Make changes to nginx default site so you can access your phpVirtualBox website

vi /etc/nginx/sites-available/default
server {
        listen   80; ## listen for ipv4; this line is default and implied
        listen   [::]:80 default ipv6only=on; ## listen for ipv6

        root /usr/share/nginx/www;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to index.html
                try_files $uri $uri/ /index.html;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules

        location /doc/ {
                alias /usr/share/doc/;
                autoindex on;
                deny all;

        # Only for nginx-naxsi : process denied requests
        #location /RequestDenied {
                # For example, return an error code
                #return 418;

        #error_page 404 /404.html;

        # redirect server error pages to the static page /50x.html
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/www;

        # pass the PHP scripts to FastCGI server listening on
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_index index.php;
                include fastcgi_params;

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        location ~ /\.ht {
                deny all;
/etc/init.d/nginx reload

Now we are going to install phpVirtualBox

cd /usr/share/nginx/www
mv phpvirtualbox-4.2-0b phpvirtualbox

Copy the config file and set the user and password for your vbox user

cd /usr/share/nginx/www/phpvirtualbox/
cp config.php-example config.php
vi config.php
/* Username / Password for system user that runs VirtualBox */
var $username = 'vbox';
var $password = 'yourpassword';

That’s it. Open your browser and login using the default username and password which is admin


Notify of
Newest Most Voted
Inline Feedbacks
View all comments

[…] va vous falloir VirtualBox 4.2, pour cela je vous renvois à ce tuto d’installation : ici J’en ai profité pour installer aussi l’interface php de VirtualBox bien pratique (cf […]

11 years ago


Thank you for your Post

I am newbie, could you please advice if I have to add the following to /apt/sources.list

deb squeeze contrib non-free
wget -q -O- | apt-key add –
apt-get update
apt-get install virtualbox-4.2

or just need to add the following to sources.list

deb squeeze contrib non-free

Then I run the following from the root

wget -q -O- | apt-key add –
apt-get update
apt-get install virtualbox-4.2