虛擬機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

寶寶好累。


但是出現了沒法直接拷貝東西去虛擬機裏面的問題。






發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章