看了很多文章,都没找到真正原因,一片文章诠释了一切。
http://blog.163.com/xhy_cy/blog/static/1049762320113167205787/
共享设置步骤:
1. 安装vitualBox增强包,注意,这里,我的主机的windows,虚拟机是RHEL5.5,在window下通过虚拟光驱将C盘 virtualbox下面的增强包iso文件载入镜像,RHEL下会自动挂在镜像,复制镜像文件,修改权限 chmod a+x X.run文件,安装。
2.安装过程出现如下错误:
注意上图中的失败选项,查看日志,日志文件如下:
-------------------------------------------------------------------------------------------------------------------------------------------------
/tmp/vbox.0/Makefile.include.header:94: *** 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.
-------------------------------------------------------------------------------------------------------------------------------------------------
到REHE5.5的镜像盘Server目录下,安装相关的kernel文件,继续上个步骤,还是有问题。日志文件报出没有找到gcc,日志信息如下:
----------------------------------------------------------------------------------------------------------------------------------------------------
make KBUILD_VERBOSE=1 -C /lib/modules/2.6.18-194.el5/build SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 modules
/usr/src/kernels/2.6.18-194.el5-i686/scripts/gcc-version.sh: line 11: gcc: command not found
/usr/src/kernels/2.6.18-194.el5-i686/scripts/gcc-version.sh: line 12: gcc: command not found
make[1]: gcc:命令未找到
test -e include/linux/autoconf.h -a -e include/config/auto.conf || ( \
echo; \
echo " ERROR: Kernel configuration is invalid."; \
echo " include/linux/autoconf.h or include/config/auto.conf are missing."; \
echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo; \
/bin/false)
mkdir -p /tmp/vbox.0/.tmp_versions
rm -f /tmp/vbox.0/.tmp_versions/*
make -f scripts/Makefile.build obj=/tmp/vbox.0
gcc -Wp,-MD,/tmp/vbox.0/.VBoxGuest-linux.o.d -nostdinc -isystem -D__KERNEL__ -Iinclude -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Wstrict-prototypes -Wundef -Werror-implicit-function-declaration -fno-delete-null-pointer-checks -Os -pipe -msoft-float -fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts -march=i686 -mregparm=3 -ffreestanding -Iinclude/asm-i386/mach-generic -Iinclude/asm-i386/mach-default -fomit-frame-pointer -g -include /tmp/vbox.0/include/VBox/VBoxGuestMangling.h -I/lib/modules/2.6.18-194.el5/build/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -I/tmp/vbox.0/vboxguest/ -I/tmp/vbox.0/vboxguest/include -I/tmp/vbox.0/vboxguest/r0drv/linux -D__KERNEL__ -DMODULE -DVBOX -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_GUEST -DIN_GUEST_R0 -DIN_MODULE -DRT_WITH_VBOX -DVBGL_VBOXGUEST -DVBOX_WITH_HGCM -DRT_ARCH_X86 -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(VBoxGuest_linux)" -D"KBUILD_MODNAME=KBUILD_STR(vboxguest)" -c -o /tmp/vbox.0/.tmp_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.
Creating udev rule for the Guest Additions kernel module.
-------------------------------------------------------------------------------------------------------------------------------
3, 在RHEL5.5镜像盘的Server目录下安装gcc相关的包(请参考上面的网址)
4.在virtualbox的“设置”--> "数据空间"设置需要共享的目录,
5.挂在命令如下:
共享E:\Linux下的所有内容,使用命令
mount -t vboxsf Linux /mnt/share
Linux是共享的文件夹名称,\mnt\share\是挂在点,share是新建的目录
一切Ok。(注意,每次重启之后都需要重新挂在,当然,我们可以编辑文件实现挂在一直生效).