由于工作需要,经常需要在linux下进行环境搭建,我选择的方式是在win7下安装VirtualBox,然后在VirtualBox安装RedHat5.4。为了能让虚拟机自动调整显示尺寸以及使用数据空间与宿主系统进行文件共享,必须在RedHat中安装增强包,也就是VBOXAdditions。OK,下
由于工作需要,经常需要在linux下进行环境搭建,我选择的方式是在win7下安装VirtualBox,然后在VirtualBox安装RedHat
5.4。
为了能让虚拟机自动调整显示尺寸以及使用数据空间与宿主系统进行文件共享,必须在RedHat中安装增强包,也就是VBOX
Additions。
OK,下面让我们开始安装。
启动虚拟机,以root登录,然后选择 “设备”-“安装增强功能”加载增强功能镜像。
打开终端,切换到刚加载的镜像所在的目录,开始安装:
由于RedHat是默认安装,缺少内核头文件,安装失败
根据提示安装缺少的包
[root@biee11g ~]# yum install kernel-devel
如果有系统DVD光盘可以将光盘配置为yum的源,详细方法可以查看我的另一篇文章
VirtualBox下RedHat
5.4 使用DVD光盘作为yum源
安装完kernel-devel之后,再次运行安装程序
[root@biee11g VBOXADDITIONS_4.1.6_74713]# sh VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.1.6 Guest Additions for Linux.........
VirtualBox Guest Additions installer
Removing installed version 4.1.6 of VirtualBox Guest Additions...
Removing existing VirtualBox DKMS kernel modules [确定]
Removing existing VirtualBox non-DKMS kernel modules [确定]
Building the VirtualBox Guest Additions kernel modules
The gcc utility was not found. If the following module compilation fails then
this could be the reason and you should try installing it.
Not building the VirtualBox advanced graphics driver as this Linux version is
too old to use it.
Building the main Guest Additions module [失败]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions [确定]
Installing the Window System drivers
Installing X.Org 7.1 modules [确定]
Setting up the Window System to use the Guest Additions [确定]
You may need to restart the hal service and the Window System (or just restart
the guest system) to enable the Guest Additions.
Installing graphics libraries and desktop services componen[确定]
[root@biee11g VBOXADDITIONS_4.1.6_74713]#
再次失败,根据提示查看/var/log/vboxadd-install.log发现如下内容:
GCM -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASEN
AME=KBUILD_STR(VBoxGuest_linux)" -D"KBUILD_MODNAME=KBUILD_STR(vboxguest)" -c -o /tmp/vbox.0/.t
mp_VBoxGuest-linux.o /tmp/vbox.0/VBoxGuest-linux.c
/bin/sh: gcc: command not found
make[2]: *** [/tmp/vbox.0/VBoxGuest-linux.o] 错误 127
make[1]: *** [_module_/tmp/vbox.0] 错误 2
make: *** [vboxguest] 错误 2
Creating user for the Guest Additions.
原来是没有安装gcc
[root@biee11g ~]# yum install gcc
安装好gcc之后,再次运行安装程序
[root@biee11g VBOXADDITIONS_4.1.6_74713]# sh VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.1.6 Guest Additions for Linux.........
VirtualBox Guest Additions installer
Removing installed version 4.1.6 of VirtualBox Guest Additions...
Removing existing VirtualBox DKMS kernel modules [确定]
Removing existing VirtualBox non-DKMS kernel modules [确定]
Building the VirtualBox Guest Additions kernel modules
Not building the VirtualBox advanced graphics driver as this Linux version is
too old to use it.
Building the main Guest Additions module [确定]
Building the shared folder support module [确定]
Doing non-kernel setup of the Guest Additions [确定]
Starting the VirtualBox Guest Additions [确定]
Installing the Window System drivers
Installing X.Org 7.1 modules [确定]
Setting up the Window System to use the Guest Additions [确定]
You may need to restart the hal service and the Window System (or just restart
the guest system) to enable the Guest Additions.
Installing graphics libraries and desktop services componen[确定]
OK,安装成功,重启。
现在view下的“自动调整显示尺寸”就可用了,至此增强包安装成功。