VirtualBox is a software that allows you to run virtual machines on your system. In this article, we will learn how to install VirtualBox on Ubuntu/Debian systems.
How to Install VirtualBox in Ubuntu
There are two ways to install VirtualBox in Ubuntu. Please note, in both cases, you need to be logged into Ubuntu as a user with sudo privileges.
1. Using Ubuntu Repositories
In this case, we will download & install VirtualBox from Ubuntu’s repositories.
Open terminal and run the following command to update Ubuntu packages.
$ sudo apt-get update
Run the following command to download & install VirtualBox.
$ sudo apt-get install virtualbox
Next, install VirtualBox Extension Pack. It provides many additional features such as support for USB 2.0 and 3.0.
$ sudo apt-get install virtualbox—ext–pack
After that you will see a couple of window prompts during installation. Enter Yes/Ok for each prompt.
Finally, on successful installation, the terminal will display the message, “Successfully installed Oracle VM VirtualBox Extension Pack”.
You can start virtualbox with the following command.
Please note, in this case, you will be able to install only the latest version of VirtualBox on Ubuntu repositories and not later versions.
2. Using VirtualBox Repositories
In this case, we will download and install VirtualBox from Oracle’s repositories. This is a longer process but installs the latest version of Virtualbox.
First, we need to install certain pre-requisites with the following command.
$ sudo apt-get install software–properties–common
GPG keys are required to verify the authenticity of downloaded VirtualBox packages. Download & Install them with the following command.
$ wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - $ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add –
Next, we need to add Virtualbox Repository to Ubuntu
$ echo "deb [arch=amd64] http://virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
Update Ubuntu Packages
$ sudo apt-get update
Next, install VirtualBox with the following command to download VirtualBox 6.1
$ sudo apt-get install virtualbox–6.1
If you want to install some other version, such as, version 5.1, then run the following command.
$ sudo apt-get install virtualbox–5.1
It is advisable to install the VirtualBox extension pack to avail additional features such as support for USB 2.0 and 3.0 for your virtual machines.
Run the following command to download the extension pack.
$ wget https://download.virtualbox.org/virtualbox/6.1.26/Oracle_VM_VirtualBox_Extension_Pack-6.1.26.vbox-extpack
Finally, run the following command to import extension pack.
$ sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.26.vbox-extpack
You can launch VirtualBox with the following command.
It will launch a graphical interface, where you can click Add/New button to create new virtual machines. You will see a dialog box where you need to select the required OS and version, and click Next. On the next dialog box, you will see many options to configure your virtual machine such as its memory, hard disk, etc. This will start the creation of Virtual Machine. Once it is created, select it from left pane and click the green button to start it.
In this article, we have learnt two ways to setup VirtualBox in Ubuntu/Debian systems. If you are not particular about installing the absolute latest version, we suggest that you use the first approach since it is easy and simple.