首页 > 代码库 > virtual box实现centos和windows共享文件夹

virtual box实现centos和windows共享文件夹

    今天在要实现centos(在virtualbox中)和windows实现共享文件夹的过程中遇到诸多错误,费了一下午时间来搞这个,首先配置共享文件夹的方法就不介绍了,这里面介绍的是在配置的过程中遇到的诸多错误
  1. 在VirtualBox的菜单里选择“设备”->“安装增强功能包(Install Guest Additions)”
  2. 之后桌面会出现一个光盘,在命令行里输入:
    • cd /media/VBOXADDITIONS_4.3.12_93733/
    • 然后输入sudo ./VBoxLinuxAdditions.run 
  3. 然后神奇的事情发生了,在安装增强功能包的时候,就出现了错误,如下
    • Building the main Guest Additions module [FAILED]
    • (Look at /var/log/vboxadd-install.log to find out what went wrong)
  4. 思索着难道是VirtualBox版本过旧吗?于是更新VirtualBox,依然于事无补
  5. 于是进入日志查看发生了什么(/var/log/vboxadd-install.log
  6. 日志里面这么写着(Error: unable to find the sources of your current Linux kernel.Specify KERN_DIR=<directory> and run Make again
  7. 奇怪,这个玩意居然说不知道当前的linux kernel源,在一个外文网站发现老外遇到同样的问题,搞了n久之后终于起效,哎,痛苦的一笔。
  8. 先是试了如下命令:
    1. $ sudo yum updatethen
    2. $ sudo yum install kernel-devel gcc
    3. $ echo export KERN_DIR=/usr/src/kernels/`uname -r` >> ~/.bashrc
  9. 然后又试了如下命令:
    1.  yum install kernel* dkms gcc
    2. Then
    3. yum install kernel-uek-devel
    4. Then reboot your machine
  10. 之后没有重启,试着重新安装增强功能包,依然错误,重启之后又试了这两个命令:yum install kernel* dkms gcc;yum install kernel-uek-devel,完事,安装增强功能包:
    Installing additional modules ...
    Removing existing VirtualBox non-DKMS kernel modules [ OK ]
    Building the VirtualBox Guest Additions kernel modules
    Building the main Guest Additions module [ OK ]
    Building the shared folder support module [ OK ]
    Building the OpenGL support module [ OK ]
    Doing non-kernel setup of the Guest Additions [ OK ]
    Starting the VirtualBox Guest Additions [ OK ]
    Installing the Window System drivers
    Installing X.Org Server 1.13 modules [ OK ]
    Setting up the Window System to use the Guest Additions [ OK ]
    You may need to restart the hal service and the Window System (or just restart
    the guest system) to enable the Guest Additions.
    终于看到绿色的ok了,真是太不容易了,然后继续mount -t vboxsf linux_share /mnt/share,linux_share是在VirtualBox中设置的共享文件名,/mnt/share是centos中新建的文件夹,注意两个文件夹名字最后不要一样,防止出现其他错误。
  11. 后来在测试的时候,我使用的是xshell,发现这玩意不支持中文,真是跪了,中国人太不容易了,特别是程序员,幸好在网上发现了这个,好东西啊,就要共享啊
  12. http://moralistxp.blog.163.com/blog/static/1161103982013112411540183/
  13. http://jingyan.baidu.com/article/3ea51489eca4b452e61bbaca.html

virtual box实现centos和windows共享文件夹