Install Virtualbox 5.2/6.1 on Ubuntu 16 headless mode

Install Prerequisites

Before installing VirtualBox 5.2/6.1, please install these packages below if your systems don’t already have them installed….

sudo apt update
sudo apt-get install gcc make linux-headers-$(uname -r) dkms

Add VirtualBox Repository

If you want to always get the latest versions of VirtualBox when they become available, you’ll want to add its software repository to Ubuntu…

Run the commands below to add the repository key to your system…

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

After adding the repository key above, run the commands below to add VirtualBox package repository.

sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) contrib"

After that, run the commands below to update Ubuntu repositories.

Installing VirtualBox

At this point, the Ubuntu system should be ready to install the latest version of VirtualBox. First you may want to remove the previous 6.0 version if you’re still running it… to do that, run the commands below:

sudo apt remove virtualbox virtualbox-6.1

Finally, run the commands below to install the latest 6.1 (major) version of the software.

Instal 6.1

sudo apt update
sudo apt-get install virtualbox-6.1

Download and install extpack of 6.1

VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.22.vbox-extpack

*Use VBoxManage command as root user.

Install 5.2

You may wish to deploy a backward edition for certain compatibility issue-

sudo apt update
sudo apt-get install virtualbox-5.2

Download and install extpack of 5.2

VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.2.44.vbox-extpack

*Use VBoxManage command as root user.

Installing phpvirtualbox First create a system user called vbox and add it to the vboxusers group:

useradd -m vbox -G vboxusers

Create a password for the vbox user:

passwd vbox

Create the file /etc/default/virtualbox and put the line


Now, run the following command to check if virtualbox kernel modules are loaded or not.

sudo systemctl status vboxdrv


sudo /etc/init.d/vboxdrv status

Sample output:

vboxdrv.service - VirtualBox Linux kernel module
Loaded: loaded (/usr/lib/virtualbox/; enabled; vendor preset: enabled)
Active: active (exited) since Thu 2015-11-26 16:38:30 IST; 42s ago

Nov 26 16:38:29 server systemd[1]: Starting VirtualBox Linux kernel module...
Nov 26 16:38:30 server systemd[1]: Started VirtualBox Linux kernel module.
Nov 26 16:38:30 server[15008]: Starting VirtualBox kernel modules....
Hint: Some lines were ellipsized, use -l to show in full.

If it, not loaded, run the following command to load them:

sudo /etc/init.d/vboxdrv setup

For Ubuntu 16 use the following packs:

apt-get install php libapache2-mod-php php-mcrypt php-mysql  php-xml php-soap unzip

Install PHPVirtualBox for 5.2 (as of this content writing there was no updated edition available after 5.2)


use mv command to /var/www/html/<virtualbox_folder>

cd /var/www/html/<virtualbox_folder>
cp config.php-sample config.php
nano config.php

Now edit the following 2 lines-

var $password = 'your_vbox_user_password';
var $vrdeaddress = 'your_virtualbox_IP';

Now login to web browser-



VBoxHeadless Running Virtual Machines With VirtualBox On A Headless Debian/ubuntu Server

VirtualBox Major Update 6.1 Released — Install | Upgrade on Ubuntu 18.04


One thought on “Install Virtualbox 5.2/6.1 on Ubuntu 16 headless mode

  1. Pingback: Install VirtualBox legacy version 5.x on CentOS 7 | Bots!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.