I’m going to setup the headless VirtualBox server and Virtual Machine management console using phpvirtualbox which is a web-based frontend written in PHP.
This is a very basic Ubuntu 12.04 LTS server with only OpenSSH services installed so I’m going to need to add a few packages.
Let’s get started…
I’ll need to install an editor:
sudo apt-get install nano
And something to extract zip files:
sudo apt-get install unzip
Add the virtualbox repository to aptitude by editing the sources.list file:
sudo nano /etc/apt/sources.list
At the bottom of the file paste this line:
deb http://download.virtualbox.org/virtualbox/debian precise contrib
Download and install the VirtualBox public key:
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add –
Update aptitude:
sudo apt-get update
I’m going to need to install some web-services to support the phpvirtualbox management software. I’ll be using Apache2 for this:
sudo apt-get install apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common apache2 apache2-doc apache2-suexec libapache2-mod-php5 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libapr1 php5-common php5-mysql php5-suhosin php-pear
Restart the Apache Web Server:
sudo /etc/init.d/apache2 restart
I’ll need the wget package to download the phpvirtualbox management console and virtualbox extensions from the web:
sudo apt-get install wget
Install virtualbox 4.2.10:
sudo apt-get install virtualbox-4.2 4.2.10
Download the extension pack:
wget http://download.virtualbox.org/virtualbox/4.2.10/Oracle_VM_VirtualBox_Extension_Pack-4.2.10-84104.vbox-extpack
Install the extension pack:
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.10-84104.vbox-extpack
Create a user for VirtualBox:
sudo adduser vboxadmin
Make this users primary group the vboxusers group:
sudo usermod -g vboxusers vboxadmin
Create the /etc/default/virtualbox file:
sudo nano /etc/default/virtualbox
And add this line:
VBOXWEB_USER=vboxadmin
Create the system links and start the virtualbox web service:
sudo update-rc.d vboxweb-service defaults
sudo /etc/init.d/vboxweb-service start
Now I’m going to go into the html root for the server:
cd /var/www
Download the phpvirtualbox zip package:
sudo wget https://phpvirtualbox.googlecode.com/files/phpvirtualbox-4.2-4.zip
Extract the software:
sudo unzip phpvirtualbox-4.2-4.zip
Rename the phpvirtualbox folder:
sudo mv phpvirtualbox-4.2-4 phpvirtualbox
Copy the example configuration file:
sudo cp config.php-example config.php
And edit that file:
sudo nano config.php
You’ll need to edit the lines for username and password:
/* Username / Password for system user that runs VirtualBox */
var $username = ‘vboxadmin‘;
var $password = ‘vboxadminspassword‘;
Our installation is now complete and you can login to the phpvirtualbox front-end by browsing to:
http://yourserver/phpvirtualbox
The default username and password are both admin
Welcome to the phpvirtualbox web-based management console for your headless Ubuntu 12.04 LTS Virtual Machine Host.
Worked like a charm. Virtualbox with phpvirutal box working great. Using Ubuntu 12.04 here as well. Havent added any machines yet, but hopefully that will go as well as the install.
Thanks for the write up!