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) 我们使用的是Ubuntu 12.10,所以需要添加到/etc/apt/sources.list的记录为:
deb http://download.virtualbox.org/virtualbox/debian quantal contrib
root@Kitty:/home/aegis# virtualbox
WARNING: 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) 运行刚才的警告让我运行的命令:
root@Kitty:/home/aegis# sudo /etc/init.d/vboxdrv setup
Stopping 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) 这次我们安装刚才的错误所说的linux-headers-3.5.0-17-generic:
root@Kitty:/home/aegis# sudo apt-get install linux-headers-3.5.0-17-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
linux-headers-3.5.0-17-generic
0 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) 再跑一次/etc/init.d/vboxdrv setup命令:
root@Kitty:/home/aegis# sudo /etc/init.d/vboxdrv setup
Stopping 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) 再次启动VirtualBox,看起来没有问题了: