VirtualBox On A Headless Ubuntu (and phpvirtualbox)

Have you got an Ubuntu server installation and you don't know what to do with it? You are in the right place... :)

I'm going to write this post as a reminder... then at the end of this post you should have a Virtualbox on a headless Ubuntu server up and running! (i hope...) and you will be able to manage it via a web browser using phpVirtualbox (Is it truly secure? Probably my next post will be about it)

Update your ubuntu installation
sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove
Install required packages
sudo apt-get install build-essential dkms
Install VirtualBox and the extension pack
sudo vi /etc/apt/sources.list.d/virtualbox.list

deb trusty contrib

wget -q -O- | sudo apt-key add -

sudo apt-get update && sudo apt-get install VirtualBox-5.0

cd /tmp/ &&  wget

sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.0.14-105127.vbox-extpack

You can create a dedicated user for that...

Test if everything is ok
sudo /etc/init.d/vboxdrv status
sudo /etc/init.d/vboxdrv setup
If you have Apache2 and PHP5 installed avoid to follow these steps

Just check if you have php-soap and php-gd installed because virtualbox speaks SOAP

sudo apt-get install apache2 php5 php5-common php-soap php5-gd
Download and install phpVirtualbox
cd /tmp/ &&  wget

unzip phpvirtualbox*.zip
sudo mv phpvirtualbox-5.0-5 /var/www/html/phpvirtualbox
sudo cp /var/www/html/phpvirtualbox/config.php-example /var/www/html/phpvirtualbox/config.php
Edit config.php
sudo vi /var/www/html/phpvirtualbox/config.php

var $username = 'userWhoRunVirtualbox';
var $password = 'itsPassword';

sudo vi /etc/default/virtualbox
Start Virtualbox
sudo /etc/init.d/vboxweb-service start

admin/admin will be your user and password... remember to change them if you don't want to be kidding by your friends