装载自:http://blog.sina.com.cn/s/blog_6e0c0fdf010199f4.html
1 检查系统内核版本[root@Jeffery]# uname -aLinux Jeffery 2.6.32-358.14.1.el6.x86_64 #1 SMP Tue Jul 16 23:51:20UTC 2013 x86_64 x86_64 x86_64 GNU/Linux2 安装软件环境 [root@Jeffery]# yum install gcc[root@Jeffery]# yum install kernel-devel[root@Jeffery]# yum install kernel-headers
这里可以先查看安装环境是否已经安装
rpm -q gcc
rpm -q kernel-devel
rpm -q kernel-headers
注:这步执行后的版kernel-devel和kernel-headers 的版本为======================================================================================================Package Arch Version Repository Size======================================================================================================Installing:kernel-devel x86_64 2.6.18-308.16.1.el5 updates 5.7MTransaction Summary======================================================================================================Install 1Package(s)Upgrade 0Package(s)3 升级系统内核注:如果不升级内核的话,那么”kernel-devel和kernel-headers”与kenerl内核的版本不一致在第一步uname-a我们看到内核版本为2.6.18-194.el5[root@Jeffery]# yum install kernelLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile* base: mirrors.163.com* extras: mirrors.163.com* updates: mirrors.163.comSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package kernel.x86_64 0:2.6.18-308.16.1.el5 set to beinstalled--> Finished Dependency ResolutionDependencies Resolved======================================================================================================Package Arch Version Repository Size======================================================================================================Installing:kernel x86_64 2.6.18-308.16.1.el5 updates 21 MTransaction Summary======================================================================================================Install 1Package(s)Upgrade 0Package(s)Total download size: 21 MIs this ok [y/N]: yDownloading Packages:kernel-2.6.18-308.16.1.el5.x86_64.rpm | 21MB 00:20 Running rpm_check_debugRunning Transaction TestFinished Transaction TestTransaction Test SucceededRunning Transaction Installing : kernel 1/1Installed: kernel.x86_640:2.6.18-308.16.1.el5 Complete!升级完了内核,现在在来看下内核的版本变更过来了没有[root@Jeffery]# uname -aLinux Jeffery 2.6.32-358.14.1.el6.x86_64 #1 SMP Tue Jul 16 23:51:20UTC 2013 x86_64 x86_64 x86_64 GNU/Linux还是没有变过来,这里要注意了。升级内核后一定要重启4 安装软件包[root@Jeffery]# rpm -ivhdkms-2.2.0.3-1.noarch.rpmPreparing... ###########################################[100%]1:dkms ########################################### [100%][root@Jeffery]# rpm -ivhVirtualBox-4.2-4.2.16_86992_el6-1.x86_64.rpmwarning: VirtualBox-4.1-4.1.10_76795_rhel5-1.x86_64.rpm: Header V4DSA signature: NOKEY, key ID 98ab5139Preparing... ###########################################[100%]1:VirtualBox-4.1 ###########################################[100%]注:先要安装dkms在装virtualbox,要不然会报错,会说你缺少依赖包5 启动virtualbox[root@Jeffery]# /etc/init.d/vboxdrv setupStopping VirtualBox kernel modules [确定]Uninstalling old VirtualBox DKMS kernel modules [确定]Trying to register the VirtualBox kernel modules using DKMSError!echoYour kernel headers for kernel 2.6.18-194.el5 cannot be foundat/lib/modules/2.6.18-194.el5/build or/lib/modules/2.6.18-194.el5/source.[失败](Failed, trying without DKMS)Recompiling VirtualBox kernel modules [失败]失败了,为么呢?就是内核的原因,都说要重启了,看下grub配置文件[root@Jeffery]# vim /boot/grub/grub.conf# grub.conf generated by anaconda## Note that you do not have to rerun grub after making changes tothis file# NOTICE: You have a /boot partition. This means that# all kernel and initrd paths are relative to /boot/, eg.# root (hd0,0)# kernel /vmlinuz-version ro root=/dev/sdb6# initrd /initrd-version.img#boot=/dev/sdadefault=0timeout=5splashp_w_picpath=(hd0,0)/grub/splash.xpm.gzhiddenmenuinitrd /initrd-2.6.18-308.16.1.el5.img这呢,虽然没重启但是也排在了首位,那么重启下看看[root@Jeffery]# reboot[root@Jeffery]# uname -aLinux Jeffery 2.6.32-358.14.1.el6.x86_64 #1 SMP Tue Jul 16 23:51:20UTC 2013 x86_64 x86_64 x86_64 GNU/Linux[[root@Jeffery]# /etc/init.d/vboxdrv setupStopping VirtualBox kernelmodules [确定]Uninstalling old VirtualBox DKMS kernelmodules [确定]Trying to register the VirtualBox kernel modules usingDKMS [确定]Starting VirtualBox kernelmodules [确定]看,VirtualBox 起来了到此,virtualbox安装结束。啥?不知道咋用?问谷老师去。^_^以上资料摘自互联网,加自己安装操作中整理。VirtualBox及dkms-2.2.0.3-1.noarch.rpm均在网上下的安装装,源里面没有啊。。。