Using Oracle VM VirtualBox for desktop virtualization is common, but did you know that you can manage VirtualBox
desktops via the Web?
Despite being a convenient way to run VMs on a desktop, not every instance of VirtualBox has to run that way. Many VirtualBox implementations run on one machine, with remote clients connecting in from other machines, or with the VMs running entirely headless. However, working with VirtualBox from another machine can be difficult, so third parties have developed ways to make the VirtualBox interface accessible through the Web.
The most successful and complete of these projects is phpVirtualBox by Ian Moore. It recreates the main VirtualBox interface in the PHP scripting language and allows you to remotely connect to VirtualBox VMs via the remote display protocol.
Requirements. The phpVirtualBox technology -- we'll call it PVB for short -- requires a few things to run: a copy of VirtualBox running on a machine that's network-accessible: a Web server that can host the PVB application itself and a recent-revision Web browser.
If you're running PVB on a system that already has a Web server, you can simply install PVB's files on that server. If not, you can install a simple Web server (PVB's authors suggest XAMPP, which I also recommend) and run PVB through that. It's also possible to install PVB on a Web server on a different computer from the one running VirtualBox, as long as the two machines are able to communicate freely over the network.
Installation. The setup process for PVB varies a great deal depending on what platform you're running on. In every case, though, you'll need to run the vboxwebsrv service, which is used to remotely control VirtualBox via the Web. You'll also need to configure PVB internally so that users can authenticate when logged in. If you have other authentication mechanisms you want to use instead of the default (for instance, LDAP rather than .htaccess-style authentication), you can use those.
Launching VMs. The PVB interface resembles the native VirtualBox interface so closely that anyone who's worked with VirtualBox should be able to jump right in. One key behavioral difference is that double-clicking on the name of a VM doesn't launch it, as is the case in the main VirtualBox interface. Instead, it brings up the Properties pane for that VM.
To launch a VM through PVB, click once on the VM name, then click Start at the top left of the PVB window. When you launch, suspend or shut down a VM, a progress bar shows up at the bottom of PVB's interface. Click Cancel next to any such progress bar to stop the action in question.
The phpVirtualBox interface is designed to resemble the real thing, so it requires little retraining to use.
If you want to connect to that VM's console through PVB, select Console from the top right. If you want to attach to a VM console and show that in its own window, click the Console button, then connect to the server and click the Detach button.
To connect to a VM console through PVB, you'll have to install the VirtualBox Extension Pack for your particular version of VirtualBox. That enables things like remote connection to machines via Remote Display. If you don't set this up, PVB won't let you manage the machine's desktop, and you'll have to deal with the VMs in question as headless servers. (Servers managed through PVB are launched as headless by default.) You'll also need to configure Microsoft's Remote Display Protocol (RDP) separately for each machine.
Also note that some VMs may not need to have Remote Display set up. If you have a Windows server in VirtualBox that you connect to through RDP, then you would scarcely need to use VirtualBox's Remote Display -- unless, of course, the whole point of doing so is to allow complete integration of all VirtualBox functions, including Remote Display, into the PVB interface.
Tips from the VirtualBox field
If you decide to use VirtualBox through a Web interface, there are a few caveats to keep in mind:
More on managing VirtualBox desktops
Using a portable version of VirtualBox
Complete guide to Oracle VM VirtualBox
Recovering VMs with VirtualBox
First, when setting up PVB's username and password, be sure to use the credentials for the user that will be running VirtualBox. I had some trouble getting this to work reliably, so I decided to use .htaccess (in Apache) for protecting the PVB interface rather than PVB's login scheme. The .htaccess security is widely understood, so it isn't too hard to set up.
Second, on Windows, when you run vboxwevsrv, be sure to redirect output to nul unless you're just testing it. By default, vboxwebsrv prints all its activity to the console, which the developers of PVB claim can sap performance when used in production.
Last, you should enable Flash to ensure that Remote Display can work. If your organization forbids the use of Flash or locks it down, you could have it enabled selectively for the server that's hosting PVB.