virtualbox共享文件夹

本文介绍在Ubuntu Server 12.04 (无图形界面) 中安装VirtualBox Guest Additions的方法,包括挂载镜像、安装增强功能、设置及自动挂载共享文件夹等步骤。

主机:windows 8

虚拟机:ubuntu server 12.04(没有图形化界面)

1、挂载Virtualbox的增加镜像

2、在ubuntu中挂载此iso

enyo@UBUNTU /media$ sudo mount /dev/cdrom /media/cdrom
mount: block device /dev/sr0 is write-protected, mounting read-only
enyo@UBUNTU /media$ ls /media/cdrom/
32Bit        autorun.sh  runasroot.sh              VBoxWindowsAdditions-amd64.exe
64Bit        cert        VBoxLinuxAdditions.run    VBoxWindowsAdditions.exe
AUTORUN.INF  OS2         VBoxSolarisAdditions.pkg  VBoxWindowsAdditions-x86.exe

3、安装增强功能

enyo@UBUNTU /media$ sudo cdrom/VBoxLinuxAdditions.run 
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.2 Guest Additions for Linux............
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.

Building the main Guest Additions module ...done.
Building the shared folder support module ...done.
Building the OpenGL support module ...done.
Doing non-kernel setup of the Guest Additions ...done.
Starting the VirtualBox Guest Additions ...done.
Installing the Window System drivers ...fail!
(Could not find the X.Org or XFree86 Window System.)

enyo@UBUNTU /mnt$ sudo reboot

虽然有报错说没有桌面环境,但是不影响共享文件夹,重启设置共享文件夹即可

4、设置共享文件夹

5、挂载共享文件夹

enyo@UBUNTU /media$ sudo mkdir myshare
enyo@UBUNTU /media$ sudo mount -t vboxsf myshare myshare

6、开机自动挂载文件夹

网上很多教程说把下面的代码加入/etc/fstab,重启即可

myshare /media/myshare vboxsf rw,gid=100,uid=1000,auto 0 0

但是系统调用fstab的时候,Virtualbox的共享目录的模块还没有加载,所以每次加载都会失败,我的解决办法是在在/etc/rc.local文件中加入一行

mount -t vboxsf myshare myshare

重新启动即可实现自动挂载

转载于:https://my.oschina.net/enyo/blog/182450

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值