参考:http://www.centoscn.com/image-text/install/2015/0512/5405.html
安装virtualbox:
1:下载VirtualBox的RHEL软件库配置文件:

 wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
2:安装RPMForge RPMForge也是CentOS官方社区推荐的第三方yum源
rpm -ivh rpmforge-release-0.5.2-1.el6.rf.i686.rpm
官方网站为: http://repoforge.org/  
forge-release软件下载页为: http://repoforge.org/use
3:安装DKMS(Dynamic Kernel Module)
yum install dkms
 
4:安装开发环境和内核: 
yum groupinstall "Development Tools"
yum install kernel-devel
5:
安装qt和qt-  
yum install qt qt-x11 
6:
下载安装VirtualBox
先在官网下载下来  https://www.virtualbox.org/wiki/Linux_Downloads

7 安装扩展:   未验证
 
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.16-95972.vbox

VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), componentExtPackFile, interface IExtPackFile, callee nsISupports
VBoxManage: error: Context: "Install(fReplace, NULL, ptrProgress.asOutParam())" at line 1140 of file VBoxManageMisc.cpp

但此时系统中已有virtualbox了,所以说这个问题可以忽略,继续接下来的。
8 /etc/init.d/vboxdrv setup    未验证

这里又出现了错误:

Building the VirtualBox Guest Additions kernel modules [FAILED] 
Your system does not seem to be set up to build kernel modules. 
Look at /var/log/vboxadd-install.log to find out what went wrong. 
Once you have corrected it, you can run /etc/init.d/vboxadd setup to build them. 
查看错误日志:
/tmp/vbox.o/Makefile.include.header:97: *** 
Error: unable to find the source of your current Linux kernel.Specify KERN_DIR= and run make again. Stop.

    解决办法:
yum install kernel
yum install kernel-devel
yum install kernel-headers
yum install gcc*
yum install make 
reboot

/etc/init.d/vboxdrv setup      



12-09 22:33
查看更多