虚拟机ubuntu设置和windows的共享文件夹


vmware workstation:12

ubuntu:16.04

参考:VMware下Ubuntu与宿主Windows共享文件夹

    VMware无法通过mount挂载共享文件夹---》下面的评论

ubuntu 执行apt-get update报错Failed to fetch


1、安装vmtool,这个在虚拟机的设置里面就有

下载完会弹出一个虚拟磁盘里面又vmtool的安装包,拷贝到home目录下,解压出来有一个vmtool的目录,在该目录下执行;

./vmware-install.pl 

疯狂回车~

2、在"虚拟机--->设置”菜单中有设置共享文件夹。先设置好和windows要共享的目录。

3、下一步执行:

sudo apt-get install open-vm-tools-dkms

发现找不到open-vm-tools-dkms,网上查询之后发现是源不对。

按如下操作依次执行:

1、 cd  /etc/apt

2、sudo mv source.list source.list.bak

3、sudo vi source.list

加入阿里的源-->保存:

deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe

4、打开文件:sudo vi /etc/resolv.conf 

添加阿里云的DNS服务器

nameserver 223.5.5.5  

nameserver 223.6.6.6

5、sudo apt-get update

6、sudo apt-get install  open-vm-tools-dkms

7、sudo vi /etc/init.d/open-vm-tools 

把“sudo mount -t vmhgfs-fuse .host:/  /mnt/hgfs/” 写到最后一行,开机自动挂载共享目录

8、执行一遍 sudo mount -t vmhgfs-fuse .host:/  /mnt/hgfs/

执行成功后~~



阿西吧! 出现了共享文件夹了~~~



==================================================完美分割线=========================================================================


好气! 在自己笔记本上这个操作就是不对!!!经历了诸多磨难终于在自己笔记本上搞出来了!!

不容易,期间遇到好多问题,趁着还有印象赶紧记一下,感觉这次应该是可以通用的!


以下来自:http://www.zhimengzhe.com/linux/209903.html

*********************************************************************************************************************************************

按网上说的挂载一下,

mount -t vmhgfs .host:/CV /mnt/hgfs/

报错 mount: unknown filesystem type ‘vmhgfs’

根据网友http://www.caojunfei.com/?p=3676中的说法

要换用以下命令

/usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other

提示fuse:bad mount point /mnt/hgfs No such file or directory

再试mkdir /mnt/win

接着/usr/bin/vmhgfs-fuse .host:/ /mnt/win -o subtype=vmhgfs-fuse,allow_other

这次ok.

ls /mnt/win

终于出现windows共享目录了。

***********************************************************************************************************************************

感觉666啊! 赶紧在自己笔记本上试一下!

干!没有vmhgfs-fuse。

忘记这个红色的网站去了没有……

发现了另外一个命令:vmshare-mounter

执行:sudo vmshare-mounter .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other

出现这个错误:

fuse: bad mount point `.host:/VmShare': No such file or directory

往百度上一搜索:

发现这个网页:https://askubuntu.com/questions/580319/enabling-shared-folders-with-open-vm-tools

摘取其中关键部分:

*****************************************************************************************************************

As the other answers didn't work for me, I finally got it working after long time of digging from this link :Files missing in /mnt/hgfs on Ubuntu VM? where PieCot gives the solution:

$ git clone https://github.com/rasa/vmware-tools-patches.git
$ cd vmware-tools-patches
$ ./patched-open-vm-tools.sh
****************************************************************************************************************

克隆下来后发现这是提供了一个vmtool的补丁。

一想难道vmtool我一直没安装成功?赶紧重新安装一次瞧瞧:

果然:

****

make[2]: *** [/tmp/modconfig-oc8JBk/vmhgfs-only/file.o] 错误 1

****

幸好有大神提供的补丁!

按着步骤操作:

执行:

 ./patched-open-vm-tools.sh
  打完补丁会自动编译并且会下载、安装一些工具。下载工具的时候系统提醒我安装失败。

崩溃……

错误 http://mirrors.aliyun.com trusty InRelease

问题在接着往百度上一搜:

进到一贴吧:http://tieba.baidu.com/p/3259946156

******************************摘取贴吧一老哥的解决方案*************************************************

不知道什么原因,优麒麟的很多源里面的软件包都不更新了,所以会出现很多404错误,你复制404错误地址搜索,全部都来自于去ubuntukylin.com 。解决办法是一条一条删除优麒麟的源列表。删除后大半年更新没出现404错误。

***********************************************************************************************************

说干就干,进到“全部设置--软件和更新” ,删除掉源列表。选择了163的服务器!

执行:sudo apt-get update

更新完成之后:

再次执行:./patched-open-vm-tool.sh

终于成功编译过去。

vm+table键  看到了“vmhgfs-fuse"命令。

执行:

sudo vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other

我这边可能因为之前的操作,/mnt/hgfs目录里面有东西~~~

mkdir /mnt/win

sudo vmhgfs-fuse .host:/ /mnt/win -o subtype=vmhgfs-fuse,allow_other

终于可以了!!

之后:

vi /etc/profile 

末尾加入:

sudo vmhgfs-fuse .host:/ /mnt/win -o subtype=vmhgfs-fuse,allow_other

宝宝好累。


但是出现了没法直接拷贝东西去虚拟机里面的问题。

 


 



  • 5
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值