Cyberithub

How to Install VirtualBox on Ubuntu 20.04 LTS

Advertisements

In this article, we will see how to install VirtualBox on Ubuntu 20.04 LTS. Virtualbox is an extremely powerful, feature rich, free and open source virtualization software available to use in almost all the famous platforms in both enterprise as well as for home use purposes. It supports a huge list of guest operating systems which makes it one of the widely used virtualization software for testing and other development purposes. It provides the flexibility of running multiple guest operating systems, completely independent to each other on same host system.

So it basically solves the problem of using separate infrastructure for each operating system you want to install and use for multiple different purposes. It provides the same capabilities just like any other physical infrastructure. One can install as many virtual machines as required only limited by the host system configuration. Being a cross-platform tool, it can be easily installed on any platform. Here we will see the steps to install VirtualBox on Ubuntu 20.04 LTS based systems. You can also check How to download and install Oracle VirtualBox on Windows 10 to know about the installation steps on Windows 10 based systems.

 

How to Install VirtualBox on Ubuntu 20.04 LTS

How to Install VirtualBox on Ubuntu 20.04 LTS

Also Read: How to Install Nmap on Ubuntu/Debian

Step 1: Prerequisites

a) You should have a running Ubuntu 20.04 LTS Server.

b) You should have sudo or root access to run privileged commands.

c) You should have apt or apt-get utility available in your Server.

d) You need atleast 1024MB of ram or more for better experience.

e) While VirtualBox itself takes very less amount of hard disk space but you probably need some space for creating virtual machines depending on your use case.

 

Step 2: Update Your Server

Before installing VirtualBox, it is required to install all the latest available updates from default Ubuntu repo by using sudo apt update && sudo apt upgrade command as shown below.

cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade
[sudo] password for cyberithub:
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:2 http://ppa.launchpad.net/flatpak/stable/ubuntu focal InRelease
Hit:3 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:4 http://in.archive.ubuntu.com/ubuntu focal InRelease
Hit:5 https://d3nt0h4h6pmmc4.cloudfront.net/ubuntu focal InRelease
Hit:6 http://ppa.launchpad.net/gencfsm/ppa/ubuntu focal InRelease
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Ign:8 https://pkg.jenkins.io/debian-stable binary/ InRelease
Hit:9 https://pkg.jenkins.io/debian-stable binary/ Release
Get:10 https://repositories.timber.io/public/vector/deb/ubuntu focal InRelease [4,947 B]
Hit:11 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 InRelease
Hit:12 http://ppa.launchpad.net/juju/stable/ubuntu focal InRelease
Hit:13 https://ngrok-agent.s3.amazonaws.com buster InRelease
Hit:14 http://ppa.launchpad.net/libreoffice/ppa/ubuntu focal InRelease
Get:15 https://dl.winehq.org/wine-builds/ubuntu focal InRelease [8,041 B]
...................................................

 

Step 3: Install VirtualBox

In the next step, you can install VirtualBox by using any of the below methods depending on your requirements and needs.

a) Using Apt

The most simplest way to install VirtualBox is from the default Ubuntu repo by using apt or apt-get package manager. In this method, you have to run sudo apt install virtualbox command as shown below. This will download and install the package along with all its dependencies from default Ubuntu repo.

cyberithub@ubuntu:~$ sudo apt install virtualbox
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libblas3 liblinear4 lua-lpeg nmap-common
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
dctrl-tools dkms libgsoap-2.8.91 liblzf1 libqt5opengl5 libqt5printsupport5 libqt5x11extras5 libsdl1.2debian libvncserver1 virtualbox-dkms virtualbox-qt
Suggested packages:
debtags menu vde2 virtualbox-guest-additions-iso
The following NEW packages will be installed:
dctrl-tools dkms libgsoap-2.8.91 liblzf1 libqt5opengl5 libqt5printsupport5 libqt5x11extras5 libsdl1.2debian libvncserver1 virtualbox virtualbox-dkms
virtualbox-qt
0 upgraded, 12 newly installed, 0 to remove and 2 not upgraded.
Need to get 45.1 MB of archives.
After this operation, 183 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
..............................................

If you are looking for extended functionalities like USB support, camera support etc then you have to install virtualbox extended pack by using sudo apt install virtualbox-ext-pack command as shown below.

cyberithub@ubuntu:~$ sudo apt install virtualbox-ext-pack
[sudo] password for cyberithub:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libblas3 liblinear4 lua-lpeg nmap-common
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
virtualbox-ext-pack
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 10.7 kB of archives.
After this operation, 142 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 virtualbox-ext-pack all 6.1.38-1~ubuntu1.20.04.1 [10.7 kB]
Fetched 10.7 kB in 2s (6,977 B/s)

During installation, it will ask you to configure virtualbox-ext-pack as shown below.

How to Install VirtualBox on Ubuntu 20.04 LTS 2

You have to accept the terms of the VirtualBox PUEL license to continue with installation. If everything goes well, then the installation will be completed successfully.

How to Install VirtualBox on Ubuntu 20.04 LTS 3

b) Using Debian Package

Then you have another method in which you can download latest debian package for Ubuntu 20.04 from official website using wget command as shown below.

cyberithub@ubuntu:~$ wget https://download.virtualbox.org/virtualbox/7.0.12/virtualbox-7.0_7.0.12-159484~Ubuntu~focal_amd64.deb
--2023-10-31 19:16:22-- https://download.virtualbox.org/virtualbox/7.0.12/virtualbox-7.0_7.0.12-159484~Ubuntu~focal_amd64.deb
Resolving download.virtualbox.org (download.virtualbox.org)... 104.104.60.39
Connecting to download.virtualbox.org (download.virtualbox.org)|104.104.60.39|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 92863472 (89M) [text/plain]
Saving to: ‘virtualbox-7.0_7.0.12-159484~Ubuntu~focal_amd64.deb’

virtualbox-7.0_7.0.12-159484~Ubuntu~foc 100%[============================================================================>] 88.56M 2.24MB/s in 2m 36s

2023-10-31 19:18:59 (580 KB/s) - ‘virtualbox-7.0_7.0.12-159484~Ubuntu~focal_amd64.deb’ saved [92863472/92863472]

After downloading the debian package, you can install it by using sudo dpkg -i virtualbox-7.0_7.0.12-159484~Ubuntu~focal_amd64.deb command as shown below.

cyberithub@ubuntu:~$ sudo dpkg -i virtualbox-7.0_7.0.12-159484~Ubuntu~focal_amd64.deb 
(Reading database ... 262401 files and directories currently installed.)
Preparing to unpack virtualbox-7.0_7.0.12-159484~Ubuntu~focal_amd64.deb ...
Unpacking virtualbox-7.0 (7.0.12-159484~Ubuntu~focal) over (7.0.12-159484~Ubuntu~focal) ...
dpkg: dependency problems prevent configuration of virtualbox-7.0:
virtualbox-7.0 depends on libqt5help5 (>= 5.9.0); however:
Package libqt5help5 is not installed.
virtualbox-7.0 depends on libqt5opengl5 (>= 5.0.2); however:
Package libqt5opengl5 is not installed.
virtualbox-7.0 depends on libqt5printsupport5 (>= 5.0.2); however:
Package libqt5printsupport5 is not installed.
virtualbox-7.0 depends on libqt5x11extras5 (>= 5.6.0); however:
Package libqt5x11extras5 is not installed.
virtualbox-7.0 depends on libqt5xml5 (>= 5.0.2); however:
Package libqt5xml5 is not installed.

dpkg: error processing package virtualbox-7.0 (--install):
dependency problems - leaving unconfigured
Processing triggers for systemd (245.4-4ubuntu3.22) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for shared-mime-info (1.15-1) ...
Errors were encountered while processing:
virtualbox-7.0

You might notice that during installation above it will complain about unmet dependencies so to install all the missing dependencies you can immediately run sudo apt install -f command as shown below.

cyberithub@ubuntu:~$ sudo apt install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
libqt5help5 libqt5opengl5 libqt5printsupport5 libqt5sql5 libqt5sql5-sqlite libqt5x11extras5 libqt5xml5
The following NEW packages will be installed:
libqt5help5 libqt5opengl5 libqt5printsupport5 libqt5sql5 libqt5sql5-sqlite libqt5x11extras5 libqt5xml5
0 upgraded, 7 newly installed, 0 to remove and 2 not upgraded.
1 not fully installed or removed.
Need to get 747 kB of archives.
After this operation, 3,198 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
..............................................

 

Step 4: Using VirtualBox

To launch VirtualBox, go to Desktop and Click on Activities. Then type VirtualBox in the search bar as shown below. Once it appears, tap on it to open.

How to Install VirtualBox on Ubuntu 20.04 LTS 4

It should open like below. Now you can proceed with the creation of Virtual Machine in VirtualBox.

How to Install VirtualBox on Ubuntu 20.04 LTS 5

 

Step 5: Uninstall VirtualBox

Once you are done using VirtualBox, you can choose to uninstall it from your system by using any of the below methods depending on how you have installed it.

a) Using Apt 

If you installed it from default ubuntu repo then you can uninstall it from your system by using sudo apt remove virtualbox command as shown below. You can also remove all dependent packages by using --auto-remove option. But be careful before using this option as it might delete some of the dependent packages which are actively used by other running applications on your system.

cyberithub@ubuntu:~$ sudo apt remove virtualbox
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
dctrl-tools dkms libblas3 libgsoap-2.8.91 liblinear4 liblzf1 libqt5opengl5 libqt5printsupport5 libqt5x11extras5 libsdl1.2debian libvncserver1 lua-lpeg
nmap-common virtualbox-dkms
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
virtualbox virtualbox-qt
0 upgraded, 0 newly installed, 2 to remove and 2 not upgraded.
After this operation, 173 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 263256 files and directories currently installed.)
Removing virtualbox-qt (6.1.38-dfsg-3~ubuntu1.20.04.1) ...
Removing virtualbox (6.1.38-dfsg-3~ubuntu1.20.04.1) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for shared-mime-info (1.15-1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...

You can also remove the extension package virtualbox-ext-pack by using sudo apt remove virtualbox-ext-pack command if it is not already removed from the previous command.

cyberithub@ubuntu:~$ sudo apt remove virtualbox-ext-pack
[sudo] password for cyberithub:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libblas3 liblinear4 lua-lpeg nmap-common
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
virtualbox-ext-pack
0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded.
1 not fully installed or removed.
After this operation, 142 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 263261 files and directories currently installed.)
Removing virtualbox-ext-pack (6.1.38-1~ubuntu1.20.04.1) ...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Successfully uninstalled "Oracle VM VirtualBox Extension Pack".
Successfully performed extension pack cleanup

b) Using Package Version

If you installed VirtualBox manually from the debian package then during uninstallation you have specify the correct version to uninstall. This you can find out by running dpkg -l | grep -i virtualbox command as shown below. As you can see, in our case we have to remove virtualbox version 7.0

cyberithub@ubuntu:~$ dpkg -l | grep -i virtualbox
rc  virtualbox                                 6.1.38-dfsg-3~ubuntu1.20.04.1        amd64          x86 virtualization solution - base binaries
ii  virtualbox-7.0                             7.0.12-159484~Ubuntu~focal           amd64          Oracle VM VirtualBox
rc  virtualbox-ext-pack                        6.1.38-1~ubuntu1.20.04.1             all            extra capabilities for VirtualBox, downloader.

After finding out the correct version, you can remove it by using sudo apt remove virtualbox-7.0 command as shown below. You can also remove all dependent packages by using --auto-remove option.

cyberithub@ubuntu:~$ sudo apt remove virtualbox-7.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libqt5help5 libqt5opengl5 libqt5printsupport5 libqt5sql5 libqt5sql5-sqlite libqt5x11extras5 libqt5xml5
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
virtualbox-7.0
0 upgraded, 0 newly installed, 1 to remove and 6 not upgraded.
After this operation, 223 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 262447 files and directories currently installed.)
Removing virtualbox-7.0 (7.0.12-159484~Ubuntu~focal) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for shared-mime-info (1.15-1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...

Leave a Comment