
VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU General Public License (GPL). See "About VirtualBox" for an introduction.
Presently, VirtualBox runs on Windows, Linux, Macintosh and OpenSolaris hosts and supports a large number of guest operating systems including but not limited to Windows (NT 4.0, 2000, XP, Server 2003, Vista, Windows 7), DOS/Windows 3.x, Linux (2.4 and 2.6), Solaris and OpenSolaris, and OpenBSD.
VirtualBox is being actively developed with frequent releases and has an ever growing list of features, supported guest operating systems and platforms it runs on. VirtualBox is a community effort backed by a dedicated company: everyone is encouraged to contribute while Sun ensures the product always meets professional quality criteria.
This tutorial will guide you how to set up a headless VirtualBox webserver to connect to your virtual machines from another host. This gives you multiple advantages including administering virtual machines without performance loss on your own system. You don't even need to run the VirtualBox GUI on you own system, let alone having VirtualBox installed on your own system. The only thing you need to administer you headless virtual machines is an RDP connection, so it's amazingly performace friendly on you own system as it doesn't use your system's resources. The virtualbox webserver can even be configured to run and administer virtualbox system within your browser.
It's like having all the pros of the virtualization concept without the cons!
Moving on to the installation part. This tutorial will guide how to set up a VirtualBox webserver on Windows Server 2003 R2 and will most likely work fine as well on the standard Windows Server 2003. This tutorial also assumes you fully updated your Windows Server 2003 R2. The XAMPP installation will be covered in the tutorial, but if you already set up XAMPP you can safely skip that part of the tutorial.
Please note that by the time I wrote this article phpVirtualBox 0.5 and VirtualBox 3.2.8 were the most recent packages so you might want to change the download links and the package names to whatever matches the now most recent versions.
- Installing XAMPP
First we'll need to install XAMPP in order to make it possible for us to use the Web UI (which I strongly recommend). I know what you're thinking: "Why not use IIS?". Well, to be honest I initially tried using IIS because I just wanted it to work without needing as much third-party software. And since IIS is Microsoft, I wanted it to work with IIS from the start. Sadly, this did not go well... and even the creator of phpVirtualBox advised against this "instead of mucking around with IIS, you may install XAMPP or XAMPPLite". I didn't really paid much attention to the above statement, but realised soon enough that I was going nowhere. IIS really drove me insane at some point and at the end I simply gave up on IIS.
So there. That's why I wrote this tutorial with XAMPP instead of IIS. If you still want to use IIS instead of XAMPP, be my guest and knock yourself out. No kidding, really, I hope you do it because I really want to know how to get phpVirtualBox to work with IIS. It has to be possible, I know it, but I couldn't figure it out so if you can get it to work with IIS I really want to know how you managed that. I'm sure a lot of guys out there would like to know too so maybe post a reply to your blog or anything.
Moving on, if you're using a virtual machine, make sure to have your network adapter bridged to your physical network adapter. In any case you want to make sure to assign the network adapter with a static TCP/IP configuration.
You can start downloading XAMPP using this link: http://www.apachefriends.org/en/xampp.html

I'd advise you to install XAMPP to the root of the hard disk. Don't worry, it'll extract all the files to a seperate xampp directory. Also, you might want XAMPP on a seperate partition. If you do, just change the drive letter given to your other partition.

The installation will now extract its files. This shouldn't take too long.

After extraction XAMPP will ask you to install shortcuts to your startmenu and your desktop. I suggest you to do this even if you don't like shortcuts on your desktop, because telling XAMPP not to do so will make XAMPP to skip the installation of shortcuts to your startmenu. And you most likely do want to manage XAMPP from your startmenu even if you don't want to manage it from your desktop. And you can simply delete the shortcuts on your desktop while leaving the shortcuts in your startmenu be.

Soon after, XAMPP asks you to continue iinstalling XAMPP. Enter yes here, because that was the whole point...

Unless you plan to move your XAMPP installation around using a USB flash drive, I'd advise to enter no here. If you do, then you had better make sure to install this XAMPP installation to your USB flash drive's root folder from the very beginning.

Just press the Enter button here.

Usally XAMPP detect the proper timezone and informs you about this. This window gives you the possibility to change it if needed.

Enter 1 here to automatically start XAMPP.

XAMPP should now have been started button right on your screen.

The command prompt window stays open after you started XAMPP. You can safely exit this window by entering x here.

Tick the checkbox on the left of Apache to make sure Apache will be started as a service from now on. After installing Apache as a service, start it by clicking the Start button on the right of Apache.
- Installing VirtualBox
Now we can install VirtualBox. Go over to this website and download the latest VirtualBox from there: http://www.virtualbox.org/wiki/Downloads. Once the download is finished you'll be presented with a screen like this.

Click next to start the installation.

Accept the license agreement and continue.

Make sure to instal all features. This also enable you to use the GUI from time to time, which can be pretty useful.

Personally I'm not very fond of my sytem overfilling itself with every shortcut, but if you're ok with it, then you might want to tick the box that applies to your personal needs.

This is simply just a warning that prcoeeding with this step, you'll lose your connection to the internet for a moment. This will only be temporary, but it's nice to know about this fact.

Click on the install button whenever you're ready.

The installation shouldn't take very long, bnut you might be presented with several windows like this one:

This is a warning that the installer is installing a non-Windows verified software package or driver. This is totally normal and it's safe to click the continue anyway button here.

Once the installation is finished, we don't need to start it. So untick the checkbox and click finish when you're done.
- Installing the VirtualBox webserver as a service
In order to make the VirtualBox webserver to automatically start during start-up we need to make this a service. Now, to do that, we need to install the Windows Server 2003 resource kit tools to create a custom service. Download the rources kit here: http://www.microsoft.com/downloads/en/details.aspx?familyid=9D467A69-57FF-4AE7-96EE-B18C4790CFFD&displaylang=en

Once you downloaded the resource kit, install the package.

Accept the license agreement and click next.

Just type in your name and maybe a dash to cover the organization text field and click next here. I don't mind and neither does VirtualBox.

Choose where to install the resource kit. I'd advise you to leave this path as it is because it'll only take 37 MiB of your hard drive.

The resource kit is installing itself now. This shouldn't take too long.

Once the installation is complete you can safely click finish here.
The next thing we want to do is making a blank service which we'll configure to automatically start the VirtualBox webserver.

Open up command prompt window and enter the following line:
"%PROGRAMFILES%\Windows Resource Kits\Tools\Instsrv.exe" "VirtualBox Webservice" "%PROGRAMFILES%\Windows Resource Kits\Tools\srvany.exe"

The command prompt will notify you afterward once the blank service was installed succesfully. Now all we got to do is configure it.

Fire up the register editor and browse to the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VirtualBox Webservice

Once there, create a new key by going to Edit -> New -> Key.

Name your new key Parameters.

Browse to your new key and once you're there, go to Edit -> New -> String Value to create a new string.

Name your new string Application and double-click it to change its values to match this:
C:\vboxwebsrv.bat

Like this. We'll be creating our custom batch script after we close the registry editor.

Now close the registry editor safely by going to File -> Exit. Of course we can't use the service yet because it's trying to invoke a file that doesn't exist yet. To solve this we'll need to creat it.
Open up a text editor like notepad and fill it with the following script:
@ECHO OFF
"C:\Program Files\Oracle\VirtualBox\vboxwebsrv.exe" >nul
EXIT
Save the file to C:\vboxwebsrv.bat
The service should now be correctly installed and can be manually started by issuing the following command in a command prompt window:
NET START "VirtualBox Webservice"

If the service successfully started you'll be presented with a similar output I received.
- Installing phpVirtualBox
Now we'll be downloading a very nice package which will enable us to administer our virtual machines thourgh our web browser. Start by downloading phpVirtualBox here: http://code.google.com/p/phpvirtualbox/downloads/list

Once you downloaded the archive, extract the contents to C:\xampp\htdocs (you might want to rename the phpvirtualbox-* folder to simply phpvirtualbox).
Now open the phpvirtualbox\config.php file in your text editor and look-up teh following lines:
var $username = 'ian';
var $password = 'pass';
Make sure to replace ian and pass to your administrator account and the administrator's password.
- Using our browser to administer VirtualBox
Great, now you can see if you can access VirtualBox at another (or the same) system with our web browser. Try connecting to it by using your IP-address, followed by a forward slash and phpvirtualbox. Your URL should look like something like this: http://192.168.1.5/phpvirtualbox.

- Finding your way around
As you can see, the Web UI looks very similar to the normal GUI that you're used to. On of the first things you'll notice is that you can actually connect to all your virtual machines from within your browser. This is really convenient, but you can even connect to your virtual machine via Remote Desktop. This doesn't mean that you're stuck to use Windows machines in order to connect to because you're connecting to your virtual machine via Remote Desktop. No, the reason for that is that the guys behind VirtualBox were savvy enough to make sure Remote Desktop would connect to your virtual machine by using their own RDP connection: VRDP.
VRDP is a compatible implementation of Microsoft’s Remote Desktop Protocol (RDP) that is configured for easy console access to the guest platform from remote systems. This means that you don't need to enable Remote Desktop on your Windows virtual machine, because it's not using that. It really connects directly to you virtual machine as if you would open the virtual machine normally in your GUI. While you're connected using VRDP you can even follow the boot procedure, which means you don't need to wait until Windows has started (because it's not using your usual RDP in Windows). And that means you can install whatever operating system you want (so not just Windows in order to use VRDP) on a virtual machine and still be able to take control over it by using Remote Desktop on a remote computer. The only thing you need to configure is to enable the virtual machine to use VRDP which can be configured when you open the settings of a virtual machine. You can configure VRDP here:

Note that you don't have to limit yourself by using port 3389 as you normally would with a native Windows RDP connection. You could enter any port you like here, but be sure not to use a port below 1024. Once you chose an available port, you can even open this port in your router at home and you can connect from to your virtual machine from over the internet. And if you open port 80 in your router, you can also connect to your Web UI from over the internet, but I'd advise against that as it wouldn't ask for login credentials, so if anyone would happen to know your IP-address he or she could easily compromise your system. Fortunatly they're countless ways to prevent this. For example by making sure your phpvirtualbox folder would be protected with with .htaccess file and a seperate .htpassword file.

In order to connect to your virtual machine, you could either manually try to connect to them, or you could easily click the port number in the settings overview and a custom .rdp file will be created for you.

You can open this file and you'll automatcally connect to your virtual machine, just like that.
At first you'll notice the mouse from the virtual machine doesn't really seem to stick to your actual mouse pointer on your own machine. Don't let this dissapoint you as this problem can be easiily solved by making sure you installed the VirtualBox Guest Additions.
Now, I can imagine you probably don't know where to find the VirtualBox Guest Additions image, but it's most likely located in the default folder (C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso).

Mount the image in your virtual machine and install the VirtualBox Guest Additions to make the mouse pointer behave normally.
- Done!
Congratulations, you successfully set up a VirtualBox webserver you can connect to to administer your virtual machines from.