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
  14. 别忙还没完,如果你不想每次都手动加载的话,那么假如您不想每一次都手动挂载,可以在/etc/fstab中添加一项 linux_share /mnt/share vboxsf rw,gid=100,uid=1000,auto 0 0,以后就会每次开机自动加载。已亲测,可用。
  15. 如果想要卸载的话,使用umount -f /mnt/share,如果出现umount2: Device or resource busy
    1. umount: /mnt/share: device is busy.
    2. (In some cases useful info about processes that use
    3. the device is found by lsof(8) or fuser(1))
    4. umount2: Device or resource busy
    5. 说明你还没有退出该目录,或者挂载设备正在使用中
  16. 如果有不确定的地方,可以参考http://jingyan.baidu.com/article/2fb0ba40541a5900f2ec5f07.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值