CentOS6.4 安裝VirtualBox

裝載自:http://blog.sina.com.cn/s/blog_6e0c0fdf010199f4.html



1 檢查系統內核版本

[root@Jeffery]# uname -a

Linux 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



2 安裝軟件環境  

[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.7M

Transaction Summary

======================================================================================================

Install 1Package(s)

Upgrade 0Package(s)



3 升級系統內核

注:如果不升級內核的話,那麼”kernel-devel和kernel-headers”與kenerl內核的版本不一致在第一步uname-a我們看到內核版本爲2.6.18-194.el5

[root@Jeffery]# 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 beinstalled

--> 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 1Package(s)

Upgrade 0Package(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 | 21MB 00:20

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : kernel 1/1

Installed:

kernel.x86_640:2.6.18-308.16.1.el5

Complete!

升級完了內核,現在在來看下內核的版本變更過來了沒有

[root@Jeffery]# uname -a

Linux 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

還是沒有變過來,這裏要注意了。升級內核後一定要重啓linux
4 安裝軟件包

[root@Jeffery]# rpm -ivhdkms-2.2.0.3-1.noarch.rpm

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

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

[root@Jeffery]# rpm -ivhVirtualBox-4.2-4.2.16_86992_el6-1.x86_64.rpm

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

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

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

注:先要安裝dkms在裝virtualbox,要不然會報錯,會說你缺少依賴包



5 啓動virtualbox

[root@Jeffery]# /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 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/sda

default=0

timeout=5

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

hiddenmenu

initrd /initrd-2.6.18-308.16.1.el5.img

這呢,雖然沒重啓但是也排在了首位,那麼重啓下看看

[root@Jeffery]# reboot

[root@Jeffery]# uname -a

Linux 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 setup
Stopping VirtualBox kernelmodules [確定]
Uninstalling old VirtualBox DKMS kernelmodules [確定]
Trying to register the VirtualBox kernel modules usingDKMS [確定]
Starting VirtualBox kernelmodules [確定]


看,VirtualBox 起來了

到此,virtualbox安裝結束。啥?不知道咋用?問谷老師去。^_^linux



以上資料摘自互聯網,加自己安裝操作中整理。VirtualBox及
dkms-2.2.0.3-1.noarch.rpm均在網上下的安裝裝,源裏面沒有啊。。。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章