Automation of everything …

Automation of everything …

VirtualBox admin using phpvirtualbox (2017)

Following on from my previous guide VirtualBox admin using phpVirtualBox, Smart Guide Pty Ltd have taken over support and released a new version 🙂

This guide explains how you can run administer VirtualBox 5.2 on a headless Ubuntu server. Normally you use the VirtualBox GUI to manage your virtual machines, but a server does not have a desktop environment.

1. Preliminary:
– Install your server environment (I chose Ubuntu)
– Install VirtualBox 5.2 (VirtualBox 5.2 on Ubuntu 17.10)

2 Start VirtualBox Web Services
Create the file /etc/default/virtualbox and put the line VBOXWEB_USER=vbox in it (so that the VirtualBox SOAP API which is called vboxwebsrv runs as the user vbox):

echo '# virtualbox defaults file' | sudo tee /etc/default/virtualbox
echo 'VBOXWEB_USER=vbox' | sudo tee -a /etc/default/virtualbox

Next create the system startup links for vboxwebsrv and start it:
sudo systemctl enable vboxweb-service
sudo systemctl start vboxweb-service

3 Install Apache2
We need a web server with PHP support to serve phpVirtualBox. Install Apache and PHP as follows:
sudo apt -y install apache2 libapache2-mod-php7.1 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libapr1 php7.1-common php7.1-mysql php7.1-soap php-pear wget

Restart Apache:
sudo systemctl restart apache2.service

4 Download and configure phpvirtualbox

cd /usr/share/
sudo git clone
cd phpvirtualbox
sudo cp config.php-example config.php

Edit config.php:
– update username/password to match headless system user already created
– set Display guest additions version of a running VM on its Details tab to true
– Enable startup / shutdown configuration.
– Enable advanced configuration items

Copy site details to Apache2

sudo cp phpvirtualbox.conf /etc/apache2/conf-available/

Modify Apache configuration to allow remote connections:
sudo vi /etc/apache2/conf-available/phpvirtualbox.conf
– Comment out the line “Require local” (line 11)
– Also at the time of my installation there is a bug in the config file, change line 6 to read “DirectoryIndex index.html”

Enable the phpVirtualBox web site:
sudo a2enconf phpvirtualbox

Restart Apache2:
sudo service apache2 reload

4. Clean up and reboot
As good practice I always update and clean up before rebooting when installing new software

sudo apt update && sudo apt upgrade
sudo apt clean && sudo apt autoclean && sudo apt autoremove

sudo reboot now

5. Check the system
That’s it already – you can now open a browser and access phpVirtualBox as follows:
eg: http://host.lab.local/phpvirtualbox/
or By IP:

Default logon is admin:admin

6. Change password:
File Menu -> Change Password

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2018: Forester IT | Easy Theme by: D5 Creation | Powered by: WordPress