A rough guide to using phpvirtualbox on Debian Wheezy:
Install VirtualBox:
apt-get install virtualbox
Create user vbox, member of group vboxusers:
adduser vbox vboxusers
If using the VirtualBox GUI change the VirtualBox menu item to run as vbox:
(suggest installing lxmenu)
VirtualBox vbox
In VirtualBox GUI change the location for VM's:
File -> Preferences -> General -> Default Machine Folder: /home/vbox
Download the Extension Pack from
www.virtualbox.org
- this is required to enable remote desktop console access (VRDP/VRDE).
Install the Extension Pack in VirtualBox GUI:
File -> Preferences -> Extensions -> Add package
(Note: you may get an error if you previously installed the Extension Pack before running VirtualBox as user vbox.
Install Apache2 with PHP5:
apt-get install apache2 php5
Download latest phpvirtualbox from
http://code.google.com/p/phpvirtualbox/downloads/list
Unzip the file, move phpvirtualbox directory to /var/www/
(using the default Apache folder here - modify as required)
Copy config.php-example to config.php
Edit /var/www/phpvirtualbox/config.php
- set the lines for $username & $password to match the account 'vbox' created ealier.
Create an init script to start the vboxwebsrv daemon:
cp /etc/init.d/skeleton /etc/init.d/vboxweb
nano /etc/init.d/vboxweb
...
start) ...
/usr/bin/vboxwebsrv -b
stop) ...
killall vboxwebsrv
Now start the new script:
/etc/init.d/vboxweb start
You should now be able to log in to phpvirtualbox:
http://hostname/phpvirtualbox
Username = admin
Password = admin
File -> Preferences -> Default Machine Folder: /home/Virtualbox VMs
/home/vbox
OK
Create a new Virtual Machine. This configuration currently fails at the point of creating the virtual disk image - to avoid this issue create the virtual machine without a startup disk, then add the disk afterwards.
To enable the remote console, edit the VM settings:
(Extension Pack must be installed under the vbox user - see above)
Settings -> Display -> Remote Display -> Enable Server; Server Port: 3391
(*Recommend not using 3389, in case xrdp is installed on the host).
Note: to use the Remote Desktop console provided through Oracle Extension Pack, the client must have Flash installed. Screen corruption in the form of unreadable dots may occur if the resolution you connect at is too low.
Note that /etc/init.d/virtualbox runs as root, hence all files will be owned by root. This may cause problems if you try to locate files in another users home folder (e.g. /home/vbox). To avoid issues with this (even root has limited write access to another users home folder[?TBC]), it may be better to change the default home machine folder to "shared" folder, e.g. "/home/VirtualBox VMs"
To start machines automatically at boot, add lines to /etc/rc.local:
# Start Virtualbox guests:
/usr/bin/VBoxHeadless -startvm Guest1 &
/usr/bin/VBoxHeadless -startvm Guest2 &