在virtualBox虚拟机中安装好CentOS5.5之后,安装增强功用起来会顺畅一点,特别是虚拟机与主机之间的交互更方便。
以root身份登录虚拟机,双击VirtualBox安装目录下的autorun.sh,运行结果如下:
1: Verifying archive integrity... All good.
2: Uncompressing VirtualBox 4.3.4 Guest Additions for Linux............
3: VirtualBox Guest Additions installer
4: Removing installed version 4.3.4 of VirtualBox Guest Additions...
5: Copying additional installer modules ...
6: Installing additional modules ...
7: Removing existing VirtualBox non-DKMS kernel modules [确定]
8: Building the VirtualBox Guest Additions kernel modules
9: The headers for the current running kernel were not found. If the following
10: module compilation fails then this could be the reason.
11: The missing package can be probably installed with
12: yum install kernel-devel-2.6.18-194.el5
13:
14: Building the main Guest Additions module [失败]
15: (Look at /var/log/vboxadd-install.log to find out what went wrong)
16: Doing non-kernel setup of the Guest Additions [确定]
17: Installing the Window System drivers
18: Installing X.Org 7.1 modules [确定]
19: Setting up the Window System to use the Guest Additions [确定]
20: The following X.Org/XFree86 configuration files were originally generated by
21: the VirtualBox Guest Additions and were not modified:
22:
23: /etc/X11/xorg.conf
24:
25: You may need to restart the hal service and the Window System (or just restart
26: the guest system) to enable the Guest Additions.
27:
28: Installing graphics libraries and desktop services componen[确定]
29: Press Return to close this window...
打开/var/log/vboxadd-install.log,得到错误信息如下:
/tmp/vbox.0/Makefile.include.header:97: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again。 停止。
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.
通过上面的提示可以可以知道找不到linux内核的源文件。具体的解决办法如下:
1.安装gcc,kernel,kernel-devel
gcc是linux下常进的编译器。kernel是内核,kernel-devel是用来构建与内核匹配的内核模块的开发软件包。安装方式很简单,直接用yum install gcc这样的形式安装即可。
2.重启电脑,系统从新的内核启动,之后再重新安装增强包即可。