Newsletter Subscribe
Enter your email address below and subscribe to our newsletter
VirtualBox is the easiest way you can install and use multiple virtual machines. The best part of using VirtualBox is it is free and available for all the major platforms including Linux, Windows and macOS.
So in this tutorial, I will walk you through 3 simple ways to install VirtualBox in Ubuntu:
.deb
package of VirtualBoxIn the end, I will also share how you can remove VirtualBox, irrespective of what method you choose from these three.
Let’s start with the first installation method.
Table of Contents
Note: Using this method, you will get a slightly older version of VirtualBox. If you want the latest release, skip to the next method.
By far, this is the easiest way you can install VirtualBox on Ubuntu. You have two options here: You can either use the software centre or use the command line.
I’ll show you both and start with the command line as I find it a more convenient and straightforward way to do things.
To install VirtualBox on Ubuntu using the command line, all you have to do is execute the following command:
sudo apt install virtualbox
That’s it!
If the command line sounds too complicated and you are looking for something easier, then you can use the Ubuntu software centre to install VirtualBox on Ubuntu.
To install VirtualBox on Ubuntu using the software centre, you need to follow two simple steps:
VirtualBox
in software centreInstall
button and enter the user password Note: While this method gives you the latest release of VirtualBox, the only way to upgrade it to the next release is to reinstall it. If you want to use the latest version with auto-update, then skip to the next method.
This is the official way of installing VirtualBox on Ubuntu where you download the .deb
file for VirtualBox and install it on your system.
To install VirtualBox in Ubuntu through the .deb
package, head over to the official download page of the VirtualBox and download the .deb
file for your Ubuntu release:
Once you are done downloading the .deb
file, open your terminal and change your directory to Downloads
using the following:
cd ~/Downloads
Next, execute the following command to install the .deb
file of VirtualBox on Ubuntu:
sudo apt install ./virtualbox*.deb
The reason why I recommend this method is it is the best of the both methods shown above. You get the latest version of VirtualBox and it will be updated automatically when you perform a system update.
This method involves adding an Oracle repository to your system by which the packages installed through that repository will automatically be updated at every system update.
First, add the key to the repository by which the packages will be verified using the following command:
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
Next, add the VirtualBox repository to your system by executing the following command:
sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib"
Now, update the repository index and install VirtualBox on Ubuntu using the following command:
sudo apt update && sudo apt install virtualbox-7.0
That’s it!
If you want to uninstall VirtualBox from Ubuntu, then, it can easily be done through a single command (still I’ll show you two commands to give you a choice).
To remove VirtualBox from Ubuntu without removing the configuration files, use the following:
sudo apt remove virtualbox virtualbox-*
To remove VirtualBox from Ubuntu including all the configuration files, use the given command:
sudo apt remove --purge virtualbox virtualbox-*
Optionally, if you want to remove additional settings, configurations and virtual hard drives, then you can use the given two commands one by one:
sudo rm ~/"VirtualBox VMs" -Rf
sudo rm ~/.config/VirtualBox/ -Rf
That’s it!
In this tutorial, I went through how you can install VirtualBox on Ubuntu in 3 different ways. I find the third method most useful as it automatically updates VirtualBox with every system update. At the end, I’ve also mentioned how you can uninstall VirtualBox from Ubuntu.
I hope you will find this guide helpful. If you have any queries or suggestions, leave us a comment.