I recently installed a new Linux machine for a colleague. He used Virtualbox and I wanted to install it for him on his new machine, too.
The obvious way would have been this:
apt install virtualbox
Along with some optional packages for X11, guest tools and so on.
The install wanted to remove ubuntu-desktop
which I think is unwanted for this use case. I switched to using the repository provided by Virtualbox itself:
The steps I used were:
Create /etc/apt/sources.list.d/virtualbox.list
:
deb http://download.virtualbox.org/virtualbox/debian xenial contrib
Installation is easy then:
apt update
# To ensure the required kernel modules are built on kernel updates
# usually already installed
apt install dkms
apt install virtualbox-5.1