First, install the tool according to the following official instructions:
Https://www.virtualbox.org/wiki/Linux_Downloads
Therefore, add the following records in/etc/APT/sources. List based on your OS version:
deb http://download.virtualbox.org/virtualbox/debian trusty contrib deb http://download.virtualbox.org/virtualbox/debian saucy contrib deb http://download.virtualbox.org/virtualbox/debian raring contrib deb http://download.virtualbox.org/virtualbox/debian quantal contrib deb http://download.virtualbox.org/virtualbox/debian precise contrib deb http://download.virtualbox.org/virtualbox/debian lucid contrib non-free deb http://download.virtualbox.org/virtualbox/debian wheezy contrib deb http://download.virtualbox.org/virtualbox/debian squeeze contrib non-free
1) We use Ubuntu 12.10, so the record to be added to/etc/APT/sources. List is:
deb http://download.virtualbox.org/virtualbox/debian quantal contrib
2) download and register the apt-secure public key of ipve:
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
3) install virtualbox:
sudo apt-get update sudo apt-get install virtualbox-4.3
4) Ubuntu/Debian users may need to install the dkms package to ensure that the kernel module of the virtualbox host is also updated when the Linux kernel version is changed:
sudo apt-get install dkms
5) Start virtualbox and a warning is displayed:
[email protected]:/home/aegis# virtualboxWARNING: The vboxdrv kernel module is not loaded. Either there is no module available for the current kernel (3.5.0-17-generic) or it failed to load. Please recompile the kernel module and install it by sudo /etc/init.d/vboxdrv setup You will not be able to start VMs until this problem is fixed.
6) run the warning to let me run the command:
[email protected]:/home/aegis# sudo /etc/init.d/vboxdrv setupStopping VirtualBox kernel modules ...done.Uninstalling old VirtualBox DKMS kernel modules ...done.Trying to register the VirtualBox kernel modules using DKMSError! Your kernel headers for kernel 3.5.0-17-generic cannot be found.Please install the linux-headers-3.5.0-17-generic package,or use the --kernelsourcedir option to tell DKMS where it‘s located ...failed! (Failed, trying without DKMS)Recompiling VirtualBox kernel modules ...failed! (Look at /var/log/vbox-install.log to find out what went wrong)
7) This time we install the linux-headers-3.5.0-17-generic mentioned in the previous error:
[email protected]:/home/aegis# sudo apt-get install linux-headers-3.5.0-17-genericReading package lists... DoneBuilding dependency tree Reading state information... DoneThe following NEW packages will be installed: linux-headers-3.5.0-17-generic0 upgraded, 1 newly installed, 0 to remove and 473 not upgraded.Need to get 946 kB of archives.After this operation, 11.2 MB of additional disk space will be used.Get:1 http://cn.archive.ubuntu.com/ubuntu/ quantal/main linux-headers-3.5.0-17-generic amd64 3.5.0-17.28 [946 kB]Fetched 946 kB in 2s (404 kB/s) Selecting previously unselected package linux-headers-3.5.0-17-generic.(Reading database ... 142701 files and directories currently installed.)Unpacking linux-headers-3.5.0-17-generic (from .../linux-headers-3.5.0-17-generic_3.5.0-17.28_amd64.deb) ...Setting up linux-headers-3.5.0-17-generic (3.5.0-17.28) ...Examining /etc/kernel/header_postinst.d.run-parts: executing /etc/kernel/header_postinst.d/dkms 3.5.0-17-generic /boot/vmlinuz-3.5.0-17-generic
8) run the/etc/init. d/vboxdrv setup command again:
[email protected]:/home/aegis# sudo /etc/init.d/vboxdrv setupStopping VirtualBox kernel modules ...done.Uninstalling old VirtualBox DKMS kernel modules ...done.Trying to register the VirtualBox kernel modules using DKMS ...done.Starting VirtualBox kernel modules ...done.
9) Start virtualbox again. It seems that there is no problem:
[email protected]:/home/aegis# virtualbox[email protected]:/home/aegis#