Install Latest Virtualbox on Ubuntu Via Official Repository

Ubuntu users can easily and quickly install the open-source Oracle Virtualbox from the Ubuntu repository. However, you are not likely to get the latest and greatest version of Virtualbox using this installation method. If you like being on the bleeding edge, then you can install the latest version of Virtualbox on Ubuntu via Virtualbox official repository. Here’s how.

Install Latest Virtualbox on Ubuntu

If you have already installed VirtualBox from the Ubuntu repository, remove it with the following command. Don’t worry about your guest OS. They will be fine.

sudo apt-get remove virtualbox
sudo apt-get autoremove

Create a new source list file for the official Virtualbox repository with a command-line text editor, such as Nano.

sudo nano /etc/apt/sources.list.d/virtualbox.list

Add this line at the end of the file.

deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian bionic contrib

install virtualbox on ubuntu oracle repository

If you are not using Ubuntu 18.04, then replace bionic by your distribution’s codename such as eoan (Ubuntu 19.10) and xenial (Ubuntu 16.04).

Save and close the file. (To save a file in Nano text editor, press Ctrl+O, then press Enter to confirm. To exit, press Ctrl+X.)

Next, run the following command to fetch and import the Oracle public key.

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -

The Oracle public key fingerprint is

B9F8 D658 297A F3EF C18D  5CDF A2F6 83C5 2980 AECF
Oracle Corporation (VirtualBox archive signing key) <[email protected]>

You can use apt-key to list fingerprints.

apt-key finger

Check the fingerprint and make sure it matches the above fingerprint.

Now update local package index and install Virtualbox

sudo apt-get update

sudo apt-get install virtualbox-6.0 dkms

dkms can automatically recompile the Virtualbox host kernel modules (vboxdrv, vboxnetflt and vboxnetadp) when you upgrade Linux kernel to a new version and this is very important for Virtualbox to work properly.

Check Virtualbox version number.

install latest virtualbox on ubuntu

Fixing Error

If you see the following error:

The Virtualbox kernel modules do not match this version of Virtualbox.

the virtualbox kernel modules do not match this version of Virtualbox

It’s because you installed an older version of Virtualbox before, then didn’t remove the old Virtualbox kernel module when you install the latest version of Virtualbox. First, run the following command to remove leftover dependency packages on your system.

sudo apt autoremove

Then run the vboxconfig command.

sudo /sbin/vboxconfig

sudo sbin vboxconfig

Make sure it shows the vboxdrv.sh: Building Virtualbox kernel modules line, which indicates it’s building a kernel module for the latest version of Virtualbox.

Wrapping Up

I hope this tutorial helped you install the latest version of Virtualbox on Ubuntu. You may also want to read:

As always, if you found this post useful,  subscribe to our free newsletter to get more tips and tricks. Take care 🙂

Rate this tutorial
[Total: 6 Average: 4.2]

One Response to “Install Latest Virtualbox on Ubuntu Via Official Repository

  • autoremove did not auto remove for me, so I had to manually remove the old packages:

    sudo apt remove virtualbox-dkms

    then run

    sudo /sbin/vboxconfig

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.


The maximum upload file size: 2 MB.
You can upload: image.