PhpVirtualBox

From ArchWiki
Revision as of 21:21, 24 January 2012 by Zombielinux (Talk | contribs) (Configuration)

Jump to: navigation, search


phpVirtualBox is an open source, AJAX implementation of the VirtualBox user interface written in PHP. As a modern web interface, it allows you to access and control remote VirtualBox instances. Much of its verbage and some of its code is based on the (inactive) vboxweb project. phpVirtualBox was designed to allow users to administer VirtualBox in a headless environment - mirroring the VirtualBox GUI through its web interface.

Installation

VirtualBox Web Service

To use the web console, you must install virtualbox-ext-oracleAUR package from AUR.

VirtualBox Web Interface (phpvirtualbox)

Install phpvirtualbox from Official Repositories on a php-capable web server.

Configuration

PHPVirtualBox 4.0+

First we have some prerequisites. php, virtualbox, phpvirtualbox, unzip, and a webserver of your choosing. I run apache so adjust accordingly.

From here on out, I assume you have a web server (with root at /srv/http) and php functioning properly.

Uncomment the 'extension=soap.so' line in /etc/php/php.ini using your favorite text editor. Don't forget to restart the webserver.

rc.d restart httpd

Move into the directory you want the webserver to point to (again /srv/http for me)

cd /srv/http

Download the latest version of phpvirtualbox from their website. At this writing it is 4.1.7.

wget `wget -q -O - http://phpvirtualbox.googlecode.com/files/LATEST.txt` -O phpvirtualbox-latest.zip

Extract the archive

unzip phpvirtualbox-latest.zip

Change the location from the extracted folder to whatever name you want. Unless configured otherwise, this will be in the address line.

{{Ic|mv phpvirtualbox-latest phpvirtualbox}

Jump into that directory to do some editing

cd phpvirtualbox

Edit the example configuration. Save as config.php

nano config.php-example

Copy that file into:

/etc/webapps/phpvirtualbox/config.php

/usr/share/webapps/phpvirtualbox/config.php

/usr/share/webapps/phpvirtualbox/lib/config.php

Change the username & password. (note these are not the login credentials)

Run vboxwebsrv as whatever user you put in the config.php file

Go to http://host/phpvirtualbox

Login using "admin" "admin" for username and password.

Go to File -> change password. Change the password.

VirtualBox Web Service

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:PhpVirtualBox#)

If you are using the OSE edition, do something like this on your virtualbox running machine.

vboxwebsrv -b --logfile /dev/null --pidfile /var/run/vbox/vboxwebsrv.pid --host 127.0.0.1

If you are using the UEL edition, there is already a vboxweb script in /etc/rc.d, what you need is adjusting the settings in /etc/conf.d/vboxweb and then start it like the other daemon.

For OSE users, you can also use these scripts form UEL edition package, just put the vboxweb.conf into /etc/conf.d and the vboxweb.rc into /etc/rc.d, you can get them from the virtualbox_binAUR.

In the Template:Filename, you should take care of VBOXWEB_USER variable which should be set to the system username running the the vboxwebsrv command.

Check that this user is in group vboxusers.

VirtualBox Web Interface

Edit /etc/webapps/phpvirtualbox/config.php

1. Change the following lines into the system username you previously set in Template:Filename as well as its password. (Yes,for now, it is clear password here, maybe this could be changed in a future release.)

var $username = ;
var $password = ;

2. Change the following line into the ip address and the port your vboxwebsrv is running and listening. For most installations, it should be localhost and tcp port 18083. It is recommended to install your virtualbox web service and the virtualbox web interface on the same machine, because the username and the password you previously set is passing as the clear text.

var $location = 'http://127.0.0.1:18083/';

3. If you do not want to use authentication, you can uncomment the following line.

#var $noAuth = true;

Edit Template:Filename or remove the following line.

deny from all

Edit Template:Filename, make sure the following lines is uncommented.

extension=json.so
extension=soap.so

If you are running apache as webserver, you can copy Template:Filename into Template:Filename, and then add following line into Template:Filename

Include conf/extra/phpvirtualbox.conf

To use the web console, you should install the virtualbox-ext-oracle package from AUR, and then change the virtual machine setting, enable the remote desktop access on display panel and specify an port different with other virtual machines.

Running

If everything works fine, visit http://YourVboxWebInterfaceServer/phpvirtualbox and it should show a login box. The initial username and password are both admin, but after login, you can change your password and control users from the web interface. If you set
Template error: are you trying to use the = sign? Visit Help:Template#Escape template-breaking characters for workarounds.
in the config.php, you should immediately see the phpvirtualbox web interface.

Debugging

If you encounter a login problem, and you are upgrade your virtualbox from 3.2.x to 4.0.x, you should run the following command to update you websrvauthlibrary in you virtualbox configuration file which has been changed from VRDPAuth.so to VBOXAuth.so.

VBoxManage setproperty vrdeauthlibrary default
VBoxManage setproperty websrvauthlibrary default 

If you are still unable to login into the interface, you can try to disable webauth by

VBoxManage setproperty websrvauthlibrary null

on virtualization server and set username and password to empty strings and set $noAuth=true in Template:Filename on web server. By doing this, you should immediatelly access the web interface without login process. And then, maybe you can try some apache access control.

External Resources