Official manual from Oracle is not clear enough. Quick steps:
- Delete old VirtualBox if installed:
sudo apt-get purge virtualbox virtualbox-dkms
- Add Oracle VirtualBox repository key to the system:
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O-| sudo apt-key add -
- Add Oracle virtualbox repository to the system:
sudo apt-add-repository "deb https://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib"
- Install virtualbox-5.2 (or later) with dkms:
sudo apt-get update && sudo apt-get install virtualbox-5.2 dkms
- Optionaly. If you had VirtialBox installed before:
sudo /sbin/vboxconfig