By Christopher P Wakefield

64px-Virtualbox_logoHow do you manage virtual machines over a network using Oracle Virtualbox? I have been asked this a couple of times recently and today I will show you how. Most of my tutorials on Virtualbox have been along the lines of installing the software onto a system and managing the virtual machines on that system in person. This works well if you have a couple of virtual desktop machines but when you have quite a few servers involved going between each server to carry out maintenance becomes very tedious.

This is where you need a piece of software called phpvirtualbox. Phpvirtualbox is an open source web based front end for Virtualbox which allows you to manage all of your virtual machines over the internet.

linux-mint-logo-128x128So lets take a look at how we set this up. For the basis of this tutorial I will be using Linux Mint 12 and Virtualbox 4.1.4.

We first need to download and install the current version of Virtualbox from the Virtualbox website.

Once installed we need to add a user who will run Virtualbox. Open up a terminal as root and type:

adduser vbox

When asked supply a user password. Next we have to add the vbox user to the vboxusers group in the /etc/group file. So type (as root):

gedit /etc/group

Add vboxusers:x:113:vbox to the file and save.

Once we have finished with Virtualbox it is time to set up our web server. Since this is Linux we will be using Apache. Open up a terminal and install the following packages:

apache2

php5-mysql

libapache2-mod-php5

mysql-server

During the install process MySQL will ask you for a root password. Make this something complex but do not forget it!!!

Once installed open up a web browser and type your server address into the address bar and you will see the message IT WORKS! This means that you have a working web server.

Now we need to download, install and configure phpvirtualbox. The current release can be downloaded from the phpvirtualbox website.

I am assuming your downloads go to your Download folder. If not replace Downloads with the location that the file was downloaded to. Open up a terminal and type the following commands one at a time:

cd Downloads

cp -a phpvirtualbox-4.1.7 /var/www/phpvirtualbox

cd /var/www/phpvirtualbox

mv config.php-example config.php

It is now time to configure the config.php file so type:

sudo gedit config.php

———————————–

/**

* phpVirtualBox example configuration.

* [@version] $Id: config.php-example 366 2011-12-01 19:56:57Z

*

* rename to config.php and edit as needed.

*

*/

class phpVBoxConfig {

/* Username / Password for system user that runs VirtualBox */

var $username = ‘vbox’;

var $password = ‘*********’;

/* SOAP URL of vboxwebsrv (not phpVirtualBox’s URL) */

var $location = [http://127.0.0.1:18083/]

/* Default language. See languages folder for more language options.

* Can also be changed in File -> Preferences -> Language in

* phpVirtualBox.

*/

var $language = ‘en’;

————————————

Locate the username and password (BOLD above) and change the password to the one you created earlier. Once done save and exit.

Now we need to make sure that Virtualbox can start at boot time and that means configuring init scripts. Open up a terminal and type:

cd /etc/init.d

and then:

sudo touch /etc/init.d/vbox.start

Now we need to configure the file so type:

sudo gedit /etc/init.d/vbox.start

Copy /usr/bin/vboxwebsrv -b into the file. Save and exit.

That is Virtualbox configured to start at boot time but we now have to enable it so type:

chmod +x /etc/init.d/vbox.start

followed by:

update-rc.d vbox.start defaults

Now it is time to reboot the server. Once it has rebooted go to a web browser and point it to your server address/phpvirtaulbox

You will now be able to manage all the virtual machines on the network from the comfort of your own chair.

Hi I am Chris the owner of ComTech. I provide IT support to both personal and business clients from my base in Alloa, Clackmannanshire. For a list of what I can offer you why not visit my website www.comtech247.net where you will find my blog, testimonials, services and much more. Start supporting a local business today so I can start supporting you.