centos6.5安装vbox
cd /etc/yum.repos.dwget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
下载跟CENTOS6.5相对对应的版本,这里下载的是VirtualBox-4.2-4.2.28_97679_el6-1.x86_64.rpm。
以root账号登录到CentOS系统。
update之前:
# rpm -qa |egrep "^kernel-|kernel-devel"
kernel-2.6.32-431.el6.x86_64
kernel-devel-2.6.32-504.8.1.el6.x86_64
update之后:
# rpm -qa |egrep "^kernel-|kernel-devel"
kernel-2.6.32-431.el6.x86_64
kernel-2.6.32-504.8.1.el6.x86_64
kernel-devel-2.6.32-504.8.1.el6.x86_64
VirtualBox需要kernel modules的支持,所以系统要先安装kernel。
#yum install kernel-devel
#yum install gcc
运行上面两个命令,其中第一个命令安装了kernel-devel,第二个命令安装了kernel-headers、glibc-headers、glibc-devel和gcc,并更新了glibc-common。
#rpm –ivh VirtualBox-4.2-4.2.28_97679_el6-1.x86_64.rpm
安装过程,除了DSA signature警告外,还有VBox内核模块安装失败的报错:
Trying to register the VirtualBox kernel modules using DKMS
(Failed, trying without DKMS)
Recompiling VirtualBox kernel modules
(look at /var/log/vbox-install.log to find out what went wrong)
此时,建立、并且启动VirtualBox kernel module:
#/etc/init.d/vboxdrv setup
也出现同样报错,
搜索了一下“DKMS”,百度百科对DKMS是这样描述的:Oikawa等人在1996年提出一种与LKM类似的动态核心模块(DKMs)技术。与LKM一样,DKMs以文件的形式存储并能在系统运行过程中动态地加载和卸载。DKMs由一个用户层的DKM服务器来管理,并非由内核来管理。当核心需要某模块时,由DKM服务器负责把相应的DKM加载;当核心的内存资源紧缺时,由DKM服务器负责卸载一个没有被使用的DKM。
试途通过命令
#yum list DKMS*
下载安装DKMS,但并没有发现DKMS源。(参考文中,是在Fedora14下运行该命令能发现源的)。后来到http://linux.dell.com/dkms/网站下载了最新的dkms驱动程序包 dkms-2.1.1.2-1.noarch.rpm。
通过命令
#rpm –ivh dkms-2.2.0.3-1.noarch.rpm
安装该包后,再运行
#/etc/init.d/vboxdrv setup
命令,还是存在问题,但不是dkms问题,而仅仅是内核的问题,
报错如下:
Trying to register the VirtualBox kernel modules using DKMS
Error!Your kernel headers for kernel 2.6.32-431.el6.x86_64 cannot be found at /lib/moduals/2.6.32-431.el6.x86_64/build or /lib/modules/2.6.32-431.el6.x86_64/source
(Failed,trying without DKMS)
Recompiling VirtualBox kernel modules
(look at /var/log/vbox-install.log to find out what went wrong)
若直接运行VBox,也有类似的警告
#VirtualBox
WARNING:The vboxdrv kernel module is not loaded.Either there is no module available for the current kernel(2.6.32-431.el6.x86_64) or it failed to load.Please recompile the kernel module and install it by
sudo /etc/init.d/vboxdrv setup
You will not be able to start VMs until this problem is fixed.
通过reboot命令重启计算机,也解决不了。
按系统提示,运行Package Updater,把要更新的软件包都更新了一遍,再重启计算机,问题依旧。
执行命令
#yum install kernel-devel
把内核更新了一次,重启,问题依旧。
执行命令
####yum install kernel-PAE-devel
####把内核更新,重启,这次重启花了比较长的时间,能看到加载VirtualBox kernel modules成功的提示。
上面这条命令不成功,重启grub界面出现2.6.32-431.el6.x86_64和2.6.32-504.8.1.el6.x86_64两个启动项,选择最新的2.6.32-504.8.1.el6.x86_64进入后,
执行
#/etc/init.d/vboxdrv setup
提示如下
# /etc/init.d/vboxdrv setup
Stopping VirtualBox kernel modules
Uninstalling old VirtualBox DKMS kernel modulesError! There are no instances of module: vboxhost
4.2.28 located in the DKMS tree.
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 DKMSError! echo
Your kernel headers for kernel 2.6.32-431.el6.x86_64 cannot be found at
/lib/modules/2.6.32-431.el6.x86_64/build or /lib/modules/2.6.32-431.el6.x86_64/source.
(Failed, trying without DKMS)
Recompiling VirtualBox kernel modules
(Look at /var/log/vbox-install.log to find out what went wrong)
Uninstalling old VirtualBox DKMS kernel modules
Stopping VirtualBox kernel modules
Uninstalling old VirtualBox DKMS kernel modulesError! There are no instances of module: vboxhost
4.2.28 located in the DKMS tree.
Trying to register the VirtualBox kernel modules using DKMS
Starting VirtualBox kernel modules
若执行
#VirtualBox
则直接运行VirtualBox,而没有任何警告或报错,表明VirtualBox已经可以正常运行。
后来才知道,操作系统在32bit x86平台上最大寻址空间只有4GB,如果要使用大于4GB的内存,就必须使用Intel的PAE(物理地址扩展)模式。对于RHEL5,缺省安装模式下是不允许检测超过4GB内存,所以需要在内核安装完毕后再安装kernel-PAE套件。由于我做测试用的是16G的Dell服务器,内存有16G,而操作系统是32bit的,所以要安装kernel-PAE-devel。
在VirtualBox上新建虚拟机,按提示进行虚拟系统环境配置,操作相对简单,设置内容大致如下:
Name:虚拟系统名称,将显示在主界面上。
OS Type:选择将安装的系统类型。
Base Memory Size:给虚拟系统分配内存,依照物理内存大小合理分配。
Boot Hard Disk:相当于给虚拟系统建立的虚拟硬盘,第一次使用肯定没有建立过,故选择"New",建立一个。
Image Typ:建立选择第一个类型,也就是动态空间。这样可以避免主机硬盘空间浪费。
Image File Name:虚拟硬盘的名字。
Image Size:划分虚拟硬盘大小。
然后就可以在虚拟机上安装Guest操作系统了。
这次装的是windows2003英文版的一个系统,系统安装完成后,可以直接上网,VBox默认使用的是NAT方式。不过分辨率不好调整。
看到有些资料说,安装完客户机系统的第一件事情,应该是安装"VirtualBox Guset Additions"。
VirtualBox Guset Additions作用,据介绍有以下几点:
1、实现客户机和主机间的鼠标平滑移动。
2、与主机实现文件共享。
3、于主机共享剪贴板的内容,也就是说直接可以在主机、客户机之间复制、粘贴。
4、使用音效系统,要不然没法用虚拟机听音乐了。
5、与主机实现时间同步。否则的话主机已经到了上午10点了,你的客户机可能还在半夜3点...
6、自动登录windows。
具体的操作是,启动客户机系统,在drives中选择"install Guset Additions"。在弹出的对话框中,基本上一路“下一步”就OK了。安装结束后,需要重启客户机系统。重启后,在客户机系统中,可以看到右下角有个四方形的图标,表示系统运行了“Oracle VM VirtualBox Guest Additions”。此时,鼠标可以在当前系统和客户机系统之前随意移动,而在装VirtualBox Guset Additions之前,要从客户机系统回到当前系统是需要按组合键“Ctrl+Alt+Delete”的。而且系统根据当前VBox窗口的大小自动调整像素,也可以全屏显示。
页:
[1]