Manage VirtualBox with phpVirtualBox (Web Based Interface)

phpVirtualBox is an open source web interface for Oracle VirtualBox, written in php with AJAX implementation. It allows you to remotely manage VirtualBox instance, really useful when you don’t have GUI in operating system. phpVirtualBox allows you control  and manage guest instance as like the VirtualBox GUI do, you wont find any difference between the web interface and VirtualBox GUI. More to that phpVirtualBox supports remote console via Oracle RDP web client that comes with Extension Pack.

Here is the small guide to setup phpVirtualBox on Ubuntu (Its supports all Linux Variants, its minimum requirement is to have the web server installed with PHP support).

Prerequisites:

Install Apache with PHP.

sudo apt-get install apache2 php5 libapache2-mod-php5

Download phpVirtualBox:

Issue the following command to download the lastest phpVirtualBox.

wget 'http://sourceforge.net/projects/phpvirtualbox/files/latest/download'

Extract it.

sudo unzip phpvirtualbox-*.zip

Move it to default document root of web server.

sudo mv phpvirtualbox-* /var/www/html/virtualbox

Configure phpVirtualBox:

We need to modify the phpVirtualBox configuration to make the successful communication with VirtualBox installation, first we need to rename sample config file (config.php-example to config.php).

sudo mv /var/www/html/virtualbox/config.php-example /var/www/html/virtualbox/config.php

Modify the config file

sudo nano /var/www/html/virtualbox/config.php

Following are the minimum configuration for phpVirtualBox. User Name / Password for the system that runs VirtualBox, in my case i am using user “raj”, because he will be configured to run vboxwebsrv service( will be set in next step).

var $username = ‘raj’;
var $password = ‘x’;

If you are running VirtualBox and php are on the same host, leave the following $location as it is.

var $location = ‘http://127.0.0.1:18083/’;

Configure vboxweb-service:

VirtualBox setup creates init script vboxweb-service when it is installed, this is used to start and stop the vboxwebserv, before starting the service, we need to have /etc/default/virtualbox file because it contains settings for the service . We need to create it manually if it does not exists.

sodo nano /etc/default/virtualbox

We must set minimum VBOXWEB_USER to run the vboxweb-service, now VirtualBox will run as “raj”;  this user and password must be entered in phpVirtualBox config file.

VBOXWEB_USER=raj

If you are running phpVirtualBox in some other host, VBOXWEB_HOST is need to be set in the same file, in this case phpVirtualBox will communicate with vboxweb-service over the network.

VBOXWEB_USER=raj

VBOXWEB_HOST=192.168.1.103

Restart the vboxweb-service.

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

Now open a web browser and point to http://your-ip-address/virtualbox, you will be asked to login. Default login is admin /admin.

phpVirtualBox – Login Page

You can find the created vm’s. You can either create a new vm or work on existing vms by taking console.

phpVirtualBox – Home Page

To take a remote console you must install VirtualBox Extension Pack and also you have to Enable Remote Console.

You can take console by clicking console tab in browser.

phpVirtualBox – WebRDP Console

OR

Take mstsc of host server where VirtualBox is running.

phpVirtualBox – RDP Console

That’s All. We welcome your comments, please do comment in comments section.

apachetoolsubuntu 14.04virtual boxvirtualbox
Comments (2)
Add Comment
  • Johnny

    Hi
    I’ve follow the tutorial and with all package I can have phpvirtualbox loaded
    and i log with admin-admin. But when i created a VM, i cannot select any Iso file. It’s
    always telling me wrong permission, permission denied.. ?
    have you started from a centos7 minimal ?
    And for your user Raj, did you run everything with raj since the Centos install or your are in Root all time..?
    Thanks again

    • Raj

      HI,

      Here i used Ubuntu as a host operating system.