centos 6 安装virtualbox

1 检查系统内核版本
 
[root@ CentOS ~]# uname -a
 
Linux centos 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:35 EDT 2010 i686 i686 i386 GNU/Linux
 
 
 
2 安装软件环境
 
yum install gcc
 
yum install kernel-devel
 
yum install 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.7 M
 
Transaction Summary
 
======================================================================================================
 
Install      1 Package(s)
 
Upgrade      0 Package(s)
 
 
 
3 升级系统内核
 
注:如果不升级内核的话,那么”kernel-devel和kernel-headers”与kenerl内核的版本不一致在第一步uname -a我们看到内核版本为2.6.18-194.el5
 
[root@centos ~]# yum install kernel
 
Loaded plugins: fastestmirror
 
Loading mirror speeds from cached hostfile
 
 * base: mirrors.163.com
 
 * extras: mirrors.163.com
 
 * updates: mirrors.163.com
 
Setting up Install Process
 
Resolving Dependencies
 
--> Running transaction check
 
---> Package kernel.x86_64 0:2.6.18-308.16.1.el5 set to be installed
 
--> Finished Dependency Resolution
 
Dependencies Resolved
 
======================================================================================================
 
 Package            Arch                Version                          Repository            Size
 
======================================================================================================
 
Installing:
 
 kernel              x86_64              2.6.18-308.16.1.el5              updates              21 M
 
Transaction Summary
 
======================================================================================================
 
Install      1 Package(s)
 
Upgrade      0 Package(s)
 
Total download size: 21 M
 
Is this ok [y/N]: y
 
Downloading Packages:
 
kernel-2.6.18-308.16.1.el5.x86_64.rpm                                          |  21 MB    00:20   
 
Running rpm_check_debug
 
Running Transaction Test
 
Finished Transaction Test
 
Transaction Test Succeeded
 
Running Transaction
 
  Installing    : kernel                                                                        1/1
 
Installed:
 
  kernel.x86_64 0:2.6.18-308.16.1.el5                                                               
 
Complete!
 
升级完了内核,现在在来看下内核的版本变更过来了没有
 
[root@centos ~]# uname -a
 
Linux centos 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
 

还是没有变过来,这里要注意了。升级内核后一定要重启



4 安装软件包

[root@CentOS ~]# rpm -ivh dkms-2.2.0.3-1.noarch.rpm

Preparing... ########################################### [100%]

1:dkms ########################################### [100%]

[root@centos ~]# rpm -ivh VirtualBox-4.1-4.1.10_76795_rhel5-1.x86_64.rpm

warning: VirtualBox-4.1-4.1.10_76795_rhel5-1.x86_64.rpm: Header V4 DSA signature: NOKEY, key ID 98ab5139

Preparing... ########################################### [100%]

1:VirtualBox-4.1 ########################################### [100%]

注:先要安装dkms在装virtualbox,要不然会报错,会说你缺少依赖包



5 启动virtualbox

[root@centos ~]# /etc/init.d/vboxdrv setup

Stopping VirtualBox kernel modules [确定]

Uninstalling old VirtualBox DKMS kernel modules [确定]

Trying to register the VirtualBox kernel modules using DKMSError! echo

Your kernel headers for kernel 2.6.18-194.el5 cannot be found at

/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@centos ~]# vim /boot/grub/grub.conf

# grub.conf generated by anaconda

#

# Note that you do not have to rerun grub after making changes to this 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/sda

default=0

timeout=5

splashimage=(hd0,0)/grub/splash.xpm.gz

hiddenmenu

initrd /initrd-2.6.18-308.16.1.el5.img

这呢,虽然没重启但是也排在了首位,那么重启下看看

[root@centos ~]# reboot

[root@centos ~]# uname -a

Linux centos 2.6.18-308.16.1.el5 #1 SMP Tue Oct 2 22:01:43 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

[root@centos ~]# /etc/init.d/vboxdrv setup

Stopping VirtualBox kernel modules [确定]

Uninstalling old VirtualBox DKMS kernel modulesError! There are no instances of module: vboxhost

4.1.10 located in the DKMS tree.

[确定]

Trying to register the VirtualBox kernel modules using DKMS[确定]

Starting VirtualBox kernel modules [确定]

看,VirtualBox 起来了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值