centos5.6下virtualbox安裝手記
最近服務器被大量外借,所以想借此推進一下虛擬化技術。虛擬機軟件特別選用了比較簡單的Virtualbox。但是居然被告知軟件裝不上,無奈之下自己動手,中間確實遇到點小問題,記錄下來以做備忘。
1. 安裝軟件環(huán)境
- yum install gcc
- yum install kernel-devel
- yum install kernel-headers
這里需要注意一下當前系統(tǒng)使用的kernel版本與安裝相應kernel-headers和kernel-devel要對應上。如果找不到相應的 包,那么就用yum install kernel把服務器也升級到同一個版本,然后選擇新內核重啟。(遠程安裝可以通過下面的對/boot/grub/grub.conf編輯實現(xiàn)切換指定內 核)
2. 安裝virtualbox軟件
rpm -ivh VirtualBox-4.1-4.1.6_74727_rhel5-1.x86_64.rpm
但是隨便調用了下vboxmanage list vms就發(fā)現(xiàn)驅動沒有編譯,根據(jù)提示執(zhí)行編譯命令,見到如下報錯:
- [root@localhost home]# sudo /etc/init.d/vboxdrv setup
- Stopping VirtualBox kernel modules [確定]
- Uninstalling old VirtualBox DKMS kernel modules [確定]
- Removing old VirtualBox pci kernel module [確定]
- Removing old VirtualBox netadp kernel module [確定]
- Removing old VirtualBox netflt kernel module [確定]
- Removing old VirtualBox kernel module [確定]
- Trying to register the VirtualBox kernel modules using DKMS[失敗]
- (Failed, trying without DKMS)
- Recompiling VirtualBox kernel modules [確定]
- Starting VirtualBox kernel modules [失敗]
- (Running VirtualBox in a Xen environment is not supported)
3. 安裝dkms
這個比較簡單,到這里http://linux.dell.com/dkms/去下載一個安裝就行了。
然后再執(zhí)行驅動編譯命令,發(fā)現(xiàn)還是出錯:
#p#
- [root@localhost home]# sudo /etc/init.d/vboxdrv setup
- Stopping VirtualBox kernel modules [確定]
- Uninstalling old VirtualBox DKMS kernel modules [確定]
- Removing old VirtualBox pci kernel module [確定]
- Removing old VirtualBox netadp kernel module [確定]
- Removing old VirtualBox netflt kernel module [確定]
- Removing old VirtualBox kernel module [確定]
- Trying to register the VirtualBox kernel modules using DKMS[確定]
- Starting VirtualBox kernel modules [失敗]
- (Running VirtualBox in a Xen environment is not supported)
4. 處理Xen環(huán)境問題
begin_msg "Starting VirtualBox kernel modules" if [ -d /proc/xen ]; then failure "Running VirtualBox in a Xen environment is not supported" fi
- [root@localhost ~]# uname -ar
- Linux localhost.localdomain 2.6.18-238.el5xen #1 SMP Thu Jan 13 16:41:45 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
- [root@localhost ~]# vim /boot/grub/grub.conf
- default=0
- timeout=5
- splashimage=(hd0,0)/boot/grub/splash.xpm.gz
- hiddenmenu
- title CentOS (2.6.18-238.el5xen)
- root (hd0,0)
- kernel /boot/xen.gz-2.6.18-238.el5
- module /boot/vmlinuz-2.6.18-238.el5xen ro root=LABEL=/ rhgb quiet
- module /boot/initrd-2.6.18-238.el5xen.img
- title CentOS-base (2.6.18-238.el5)
- root (hd0,0)
- kernel /boot/vmlinuz-2.6.18-238.el5 ro root=LABEL=/ rhgb quiet
- initrd /boot/initrd-2.6.18-238.el5.img
- virtualbox vt-x is not available