How 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.
So 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. For details on how to set up a Linux web server follow this tutorial.
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
——————————————————————————————————–
<?php
/**
* phpVirtualBox example configuration.
* @version $Id: config.php-example 366 2011-12-01 19:56:57Z [email protected] $
*
* 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 http://your_server_address/phpvirtualbox
You will now be able to manage all the virtual machines on the network from the comfort of your own chair.
About the Author
Hi I am Chris Wakefield the owner of ComTech IT Support. I provide Windows, Mac and Linux based IT Support to small businesses in and around Stirling.