I always have problems with this. I found a very nice blogpost that was very easy to follow and in my case very complete (http://aahank.com/2013/install-virtualbox-on-ubuntu/). All credit goes to http://aahank.com/.
I’ll summarise this for my own future installations of VirtualBox 🙂
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get install dkms
Now we are ready to install VirtualBox. So go ahead and download the latest stable package for your Linux distribution here. Double click the downloaded .deb file and install as usual.
sudo usermod -aG vboxusers username
(Don’t forget to replace ‘username’ in the above command with yours.)
One last thing. You might also want to install the VirtualBox Extension Pack as it enables support for USB 2.0 devices, among a few others. You can download it here, and install then install it in two ways:
- Double-click on the package file, and let the VirtualBox Manager guide you through the process.
- Start Oracle VirtualBox from Ubuntu Dash, then go to File → Preferences, select Extensions tab in the settings window, and click Add package button.
Before you create a virtual machine, be sure to restart your PC.
Create a VM. Then start the VM, and installation of the operating system should begin. Once done, restart the VM, and when the guest OS is fully up, install VirtualBox Guest Additions by going to Devices → Install Guest Additions….
If the gui of the OS installed on a virtual machine is laggy, try disabling Hardware Virtualization.