VirtualBox 5.2 on Ubuntu 16.04 LTS Server (Headless)

When you have to test multiple operating systems and software on different platforms, VirtualBox is a tool to have. It is a cross-platform virtualization software that allows you to run guest operating system inside a windows of the host computer. The guest machine can Windows, Linux or Mac operating systems.

VirtualBox is a powerful application that I’d recommend every IT student to download and install to create virtual labs. These labs can be a self-contained environments where you can test different applications and settings.

This brief tutorial shows students and new users how to install VirtualBox on Ubuntu 16.04 LTS servers. If you’re reading this post then you probably know a thing or two about VirtualBox.

To install VirtualBox on Ubuntu servers, follow the steps below

Step 1: Update Ubuntu

Before installing VirtualBox, run the commands below to update the Ubuntu server.

sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove

Step 2: Install Required Linux Headers

Now that your system is updated, run the commands below to install required Ubuntu linux headers.

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

Step 3: Add VirtualBox Repository and key

After installing the required package above, run the commands below to install VirtualBox repository key.

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

Next run the commands below to add VirtualBox repository to your system.

sudo sh -c 'echo "deb $(lsb_release -sc) contrib" >> /etc/apt/sources.list'

Step 4: Install VirtualBox

After adding the repository and key, run the commands below to install VirtualBox 5.2. At the time of this writing the latest version of the software was 5.2. If there are newer versions available, please replace the 2 below with the current latest.

sudo apt-get update
sudo apt-get install virtualbox-5.2

To verify if VirtualBox is installed, run the commands below.

VBoxManage -v

Step 5: Install VirtualBox Extension Pack

Everytime you install VirtualBox make sure to install the extension pack as well. The pack enables VRDP (Virtual Remote Desktop Protocol) and many other enhancements.

To install it, run the commands below

curl -O
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.2.4-119785.vbox-extpack

Agree to the terms and install.

Run the commands below to view the extension pack installed.

VBoxManage list extpacks

The results should look like the one below:

richard@ubuntu1604:~$ VBoxManage list extpacks
Extension Packs: 1
Pack no. 0:   Oracle VM VirtualBox Extension Pack
Version:      5.2.4
Revision:     119785
Description:  USB 2.0 and USB 3.0 Host Controller, Host Webcam, VirtualBox RDP, PXE ROM, Disk Encryption, NVMe.
VRDE Module:  VBoxVRDP
Usable:       true
Why unusable:

This is how to install VirtualBox on Ubuntu 16.04 LTS servers


In our next post, we’ll show you how to create new guest machines from the command line in VirtualBox. Until then, please stay tuned.

You may also like the post below:

4 Replies to “VirtualBox 5.2 on Ubuntu 16.04 LTS Server (Headless)”

  1. You are missing the step to add the hdd to the VM.
    The current setup has a DVD drive as port0, device 0.. and no hdd to install the os onto.
    This setup works great if you are running a live cd image or the like…

  2. I followed this guide and received errors when command “sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.4r136177.vbox-extpack” was executed. Here are the error lines:

    VBoxManage: error: RTZipGzipDecompressIoStream failed: VERR_ZIP_BAD_HEADER

    VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ExtPackFileWrap, interface IExtPackFile, callee nsISupports

    VBoxManage: error: Context: “Install(fReplace, __null, ptrProgress.asOutParam())” at line 1360 of file VBoxManageMisc.cpp.

    I was tryng to install Virtual Box v6.1. The command “VBoxManage -v” returned “6.1.4r136177”.

    Many thanks in advance.

    1. I have installed VB 5.2 as in your guide. Extensions worked OK,as well. Cancel my previous post. Thanks for understanding.

Leave a Reply

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

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