install virtualbox ubuntu 20.04 code example

Example 1: install virtualbox ubuntu 20 wsl command line

sudo apt-add-repository "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib"

Example 2: how to install virtualbox in ubuntu

wget –q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
#use codename of your linux version,for my case focal is codename for 
#ubuntu 20.04.1
sudo add-apt-repository "deb http://download.virtualbox.org/virtualbox/debian focal contrib"
#you can check codename of your system using command below
lsb_release -cs
sudo apt update && sudo apt install virtualbox-6.1

Example 3: virtualbox in ubuntu 20.04

# install oracle Virtualbox in Ubuntu 20.04
sudo apt update
sudo apt install virtualbox virtualbox-ext-pack