phpVirtualBox installation on Debian Linux and Apache2 web server

phpVirtualBox allows you to manage locally or remotely your virtual machines running under VirtualBox via web-based interface. This config will describe an installation and basic configuration of phpVirtualBox on Debian Linux.

First, we need to install apache2 and php support:

# apt-get install libapache2-mod-php5 apache2 unzip wget

Next, we need to download phpVirtualBox. Please update your download link if necessary:

$ wget http://downloads.sourceforge.net/project/phpvirtualbox/phpvirtualbox-4.3-2.zip

Next, we will unzip and move the phpVirtualBoxcode into root directory of our apache2 webserver directory.

# unzip phpvirtualbox-4.3-2.zip
# mv phpvirtualbox-4.3-2/ /var/www/html/vbox

Next, we need to setup our config.php file. First, copy a config.php-example the example config file to config.php.:

# cd /var/www/html/vbox
# cp config.php-example config.php

By default the example config file works well. All what is required is to set a username and password for a user which is running virtual box. To do this open your new config.php and change to following lines to reflect to the credentials of your virtual box user:

/* Username / Password for system user that runs VirtualBox */
var $username = 'vboxuser';
var $password = 'password';

Change the owner of the entire vbox directory containing all phpVirtualBox files to www-data:

# chown -R www-data.www-data /var/www/html/vbox 

What has left is to start VirtualBox Web server. The virtual box web server should be started by the user defined in config.php file:

$ vboxwebsrv -H 127.0.0.1
Oracle VM VirtualBox web service Version 4.3.18_Debian
(C) 2007-2015 Oracle Corporation
All rights reserved.
VirtualBox web service 4.3.18_Debian r96516 linux.amd64 (Jan 26 2015 11:31:36) release log
00:00:00.000159 main     Log opened 2015-02-28T08:25:43.845995000Z
00:00:00.000162 main     Build Type: release
00:00:00.000166 main     OS Product: Linux
00:00:00.000167 main     OS Release: 3.16.0-4-amd64
00:00:00.000169 main     OS Version: #1 SMP Debian 3.16.7-ckt2-1 (2014-12-08)
00:00:00.000201 main     DMI Product Name: Z68X-UD3-B3
00:00:00.000211 main     DMI Product Version:  
00:00:00.000307 main     Host RAM: 7986MB total, 6284MB available
00:00:00.000312 main     Executable: /usr/lib/virtualbox/vboxwebsrv
00:00:00.000313 main     Process ID: 8333
00:00:00.000314 main     Package type: LINUX_64BITS_GENERIC (OSE)
00:00:00.161962 SQPmp    Socket connection successful: host = 127.0.0.1, port = 18083, master socket = 9

now you can access your phpVirtualBox web interface by navigating your browser to:

http://localhost/vbox/

Where the default phpVirtualBox‘s username name and password is:

username: admin
password: admin

php virtual box web interface - localhost