How To Install VirtualBox 6.x on Ubuntu 18.04

VirtualBox is an open-source hypervisor software that allows you to create and run virtual machines such as Linux, Windows, OS/2, Solaris, and others on top of the host operating system. It is an alternative to VMware workstation and Kernel Virtual Machine.
VirtualBox can be installed on Linux, Windows, macOS, and Solaris. Oracle releases VirtualBox as a free software under GPL v2 and Oracle VM VirtualBox extension pack under PUEL which restricts the commercial usage.
Here, we will install VirtualBox 6.x on Ubuntu 18.04.
System Requirements
To run 64bit virtual machines, make sure your processor supports hardware virtualization, and VT is enabled in BIOS. Also, the host operating system must be 64bit as well.
Install VirtualBox
Import the GNU Public Key of the Oracle VirtualBox repository and add it to your system using the below command.
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
Add the VirtualBox repository on to your system.
echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian bionic contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
Update the Ubuntu repository index.
sudo apt update
Install the VirtualBox using the apt
command.
sudo apt install -y virtualbox-6.0
Check the vboxdrv status.
systemctl status vboxdrv
Mar 28 08:36:05 desktop.linuxbees.local systemd[1]: Starting VirtualBox Linux kernel module… Mar 28 08:36:05 desktop.linuxbees.local vboxdrv.sh[12018]: vboxdrv.sh: Starting VirtualBox services. Mar 28 08:36:05 desktop.linuxbees.local vboxdrv.sh[12023]: Starting VirtualBox services. Mar 28 08:36:06 desktop.linuxbees.local vboxdrv.sh[12047]: VirtualBox services started. Mar 28 08:36:06 desktop.linuxbees.local systemd[1]: Started VirtualBox Linux kernel module.
Notes
Ubuntu with UEFI Secure Boot
On my system, the above vboxdrv kernel modules service didn’t start and got failed. Upon checking, I found UEFI caused the issue. So, I had to sign those modules by a key trusted by the UEFI system.
I suggest you perform the steps mentioned in the below link if you have UEFI enabled in BIOS before accessing the VirtualBox.
READ: VirtualBox + Secure Boot + Ubuntu = fail @ Øyvind Stegard
Access VirtualBox
Command Line Mode
virtualbox
OR
Graphical Mode
Activities » Search for Oracle VM VirtualBox.
VirtualBox 6.0 Running on Ubuntu 18.04:
Install Oracle VM VirtualBox Extension Pack
Oracle offers extension pack to add additional functionalities such as USB 2.0/3.0, VirtualBox Remote Desktop Protocol (VRDP) support, Disk encryption, Host webcam passthrough, Intel PXE boot ROM, and PCI passthrough to the Oracle VM VirtualBox base installation.
cd /tmp
wget https://download.virtualbox.org/virtualbox/6.0.4/Oracle_VM_VirtualBox_Extension_Pack-6.0.4.vbox-extpack
Check if any extension pack is already present on your system.
sudo VBoxManage list extpacks
Install the VirtualBox extension pack.
cd /tmp
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-*.vbox-extpack
. . .
exclusive jurisdiction of, and venue in, the courts of San Francisco or Santa Clara counties in California in any dispute arising out of or relating to this Agreement.
Do you agree to these license terms and conditions (y/n)? Y
License accepted. For batch installaltion add –accept-license=56be48f923303c8cababb0bb4c478284b688ed23f16d775d729b89a2e8e5f9eb to the VBoxManage command line.
0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100% Successfully installed “Oracle VM VirtualBox Extension Pack”.
Verify the installed extension pack with the following command.
sudo VBoxManage list extpacks
Conclusion
You have successfully installed VirtualBox on Ubuntu 18.04. What are you waiting for? Go and play with it by creating virtual machines!.