Install Oracle VirtualBox 5.0 On A Headless Ubuntu Server

Today I'll be showing you how to install VirtualBox 5.0 on a headless Ubuntu Server along with phpVirtualBox 5 to allow remote management using a Web GUI.

Why use VirtualBox?

Simple.  It's free. It's a Type 2 hypervisor that basically runs on most hardware, unlike most Type 1 hypervisors that are limited to certain supported hardware.

VirtualBox is cross platform and runs on Mac/Linux/Windows, which means you can use your existing machine - no dedicated server required.  But in this instance I'll be using a spare HP MicroServer that I have laying around.

Preparing The Server

We start off with a basic Ubuntu Server installation - I'm using 14.04.3 LTS.

Ensure that it's updated by executing:

sudo apt-get update && sudo apt-get upgrade -y

Install the required prerequisites for VirtualBox to install successfully:

sudo apt-get install build-essential dkms -y

Installing Oracle VirtualBox

Append the Oracle VirtualBox repository to /etc/apt/sources.list:

deb trusty contrib

And add the VirtualBox repository's public key to your system:

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

Run an update to pull in the repository:

sudo apt-get update

Then install VirtualBox 5.0:

sudo apt-get install virtualbox-5.0 -y

During the VirtualBox installation the 'vboxusers' group is created.  Add your user account to this group, which allow your user to access USB devices from VirtualBox guests.  In this instance my user is called 'vlab':

sudo usermod -aG vboxusers vlab

Check if VirtualBox's module are loaded by running:

sudo /etc/init.d/vboxdrv status

Else run:

sudo /etc/init.d/vboxdrv setup

Installing VirtualBox Extension Pack

The VirtualBox Extension Pack enables additional support for USB 2.0 and USB 3.0 devices, VirtualBox RDP and PXE boot for Intel cards.  Download the extension package compatible with your version from :


Install the pack using VBoxManage:

sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.0.12-104815.vbox-extpack

Installing phpVirtualBox

phpVirtualBox is an open source PHP based AJAX web interface for VirtualBox that mimics the desktop GUI allowing you to administrate it via a web browser - links are on the site under 'Hot Picks' or you can go directly to phpVirtualBox's page.

To install it we need to download some prerequisites again, mainly Apache, PHP and unzip:

sudo apt-get install apache2 php5 php5-mysql libapache2-mod-php5 php-soap unzip

Then we download the latest phpVirtualBox version from the official site:


Unzip the files:


Move the extracted files to Apache's root folder structure under phpVirtualBox which will make it available via the browser under http://<YOUR_IP_ADDRESS>/phpvirtualbox :

sudo mv phpvirtualbox-5.0-5 /var/www/html/phpvirtualbox

And grant full access to the folder:

sudo chmod 777 /var/www/html/phpvirtualbox

Configuring phpVirtualBox

Configure a config file by copying the existing config.php-example:

sudo cp /var/www/html/phpvirtualbox/config.php-example /var/www/html/phpvirtualbox/config.php

Then edit the 'config.php' file:

sudo nano /var/www/html/phpvirtualbox/config.php

and change the username/password to that of the user that will be running VirtualBox (the user added to the 'vboxusers' group earlier) - in my exmple it will be vlab/vlab and save the changes:

var $username = 'vlab';
var $password = 'vlab';

In order for vboxweb-service start vboxwebsrv, the file /etc/default/virtualbox must exist, create the file:

sudo nano /etc/default/virtualbox

and specify the setting for the user vboxweb will use (again I'm using my account - vlab):


And then start the service:

sudo /etc/init.d/vboxweb-service start

Accessing phpVirtualBox

You should now be able to browse over to http://<YOUR_IP_ADDRESS>/phpvirtualbox and get the login prompt:

The default credentials are just admin/admin

From here you can manage your VM's exactly like you would with the desktop application.


If your console button appears to be grayed out confirm that the extension pack was installed successfully using:

vboxmanage list extpacks

which should return 'Extension Packs:  1' :

Also check if Remote Desktop is enabled on the Virtual Machine by clicking on it, then selecting Settings -> Remote Display

Your Console button should no be working

By @Wynand Booysen in
Tags : #headless, #ubuntu, #virtualbox,

Comments !