according to Oracle Official Doc for Linux Download you can install virtual box
by adding it's repository using two ways
1 - add it's repository(according to your ubuntu version) directry into /etc/apt/sources.list
file [next line for ubuntu 16.04 xenial repositty]
deb http://download.virtualbox.org/virtualbox/debian xenial contrib
2 - adding it's repository using command line [next line for ubuntu 16.04 xenial repositty]
sudo apt-add-repository "deb http://download.virtualbox.org/virtualbox/debian xenial contrib"
Notice:for another ubuntu version use the same repository But change xenial
word with your ubuntu version name
deb http://download.virtualbox.org/virtualbox/debian {ubuntu-version-name} contrib
Then add Oracle public keys by copy key from oracle_vbox_2016.asc , oracle_vbox.asc and paste them into two files oracle_vbox_2016.asc
, oracle_vbox.asc
finally add them into your system
sudo apt-key add oracle_vbox_2016.asc
sudo apt-key add oracle_vbox.asc
Another way to adding Oracle public keys using command lines
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 -
after last two steps, you need to install virtual box
using apt-get install
command line:
sudo apt-get update
sudo apt-get install virtualbox-5.1
you can install virtual box
manually By download it's dab packages which exists into Oracle Official Doc for Linux Download Example: download link for Ubuntu 16.04 xenial 64 bits dab package
Notices
answer of @Kostanos same as my answer but install virtualbox-5.0
also for more link for installing virtual box