(Look at /var/log/vbox-install.log to find out what went wrong)
yum install VirtualBox-4.1
yum install kernel
yum install kernel-devel
yum install gcc
yum groupinstall 'Development Tools'
yum install kernel-PAE-devel
编译错误解决办法:
如果以上办法还不行的话,例如编译日志/var/lib/dkms/vboxhost/4.1.8/build/make.log中出现如下错误,
/tmp/vbox.0/r0drv/linux/.tmp_memobj-r0drv-linux.o /tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c
/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c: 在函数‘rtR0MemObjNativeLockKernel’中:
/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:910:12: 警告: 比较指针和整数 [默认启用]
/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:910:58: 警告: 比较指针和整数 [默认启用]
/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c: 在函数‘rtR0MemObjLinuxDoMmap’中:
/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:1074:9: 错误: 隐式声明函数‘do_mmap’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[2]: *** [/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.o] 错误 1
make[1]: *** [_module_/tmp/vbox.0] 错误 2
make: *** [vboxguest] 错误 2
那么,你就只好到http://download.virtualbox.org/virtualbox/去下载最新版本的virtuaBox吧
到 “添加/删除软件” 中删除旧版本VirtualBox,安装新版本
[root@localhost home]# rpm -ivh VirtualBox-4.2-4.2.4_81684_fedora16-1.i686.rpm
warning: VirtualBox-4.2-4.2.4_81684_fedora16-1.i686.rpm: Header V4 DSA/SHA1 Signature, key ID 98ab5139: NOKEY
Preparing... ########################################### [100%]
1:VirtualBox-4.2 ########################################### [100%]
Creating group 'vboxusers'. VM users must be member of that group!
No precompiled module for this kernel found -- trying to build one. Messages
emitted during module compilation will be logged to /var/log/vbox-install.log.
Stopping VirtualBox kernel modules [确定]
Uninstalling old VirtualBox DKMS kernel modules [确定]
Trying to register the VirtualBox kernel modules using DKMS[确定]
Starting VirtualBox kernel modules [确定]