How to install VirtualBox on Ubuntu 20.04 machine

Overview:

  1. Ubuntu 20.04
  2. VirtualBox 6.1

Installation:

  1. Install Oracle's GPG keys:
    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 -
    
  2. Add VirtualBox repository to your packages sources list:
    echo "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list
    
  3. Update packages:
    sudo apt-get update
    
  4. Install the VirtualBox version:
    sudo apt-get install virtualbox-6.1
    
  5. Confirm that VirtualBox is running:
    VBoxManage --version
    

Notes:

In Linux, the repository is a storage location hosted on remote servers from which the system retrieves and installs software and updates. These repositories are listed in the /etc/apt/sources.list file and in the files under the /etc/apt/sources.list.d/ directory. This file and directory contain software repositories, known as standard repositories.

Reference:

  1. VirtualBox Linux downloads
  2. How to Install VirtualBox on Ubuntu
  3. Understanding and Using Debian sources.list