みーのぺーじ

みーが趣味でやっているPCやソフトウェアについて.Python, Javascript, Processing, Unityなど.

VMware FusionでUbuntu 16.04の共有フォルダを有効にする

VMware FusionでUbuntu 16.04の共有フォルダがうまく動かなかったのですが,解決できたのでその方法をまとめておきます.

バージョン

  • VMware Fusion 8.5.3 [Download]
  • Ubuntu 16.04.1 LTS (Xenial Xerus) [Download]
  • open-vm-tools

VMwareのヘルプの方法ではうまくいかない

公式ヘルプには以下のようにすればよいと書いてありますが,うまく行きませんでした./mnt/hgfsが存在しないとエラーが出ます.

Launch VMware Fusion. *1
Power off the virtual machine.
Click Virtual Machine > Settings.
Click Sharing.
In Fusion 8.x and 7.x, select Enable Shared Folders. In Fusion 6.x, 5.x and 4.x, turn ON the Shared folders option. In Fusion 3.x, select the Share folders on your Mac option.
Click the + button.
Enter the share name, browse to the folder on the Mac that will be shared with the virtual machine and click Add.
Click Apply, then OK.
Power on the virtual machine.
Open the Terminal utility in the guest operating system.
Browse to the Host Guest File System (HGFS) folder by running this command:
cd /mnt/hgfs

解決方法

VMware FusionにUbuntuをインストールします.ゲストOSにはVMware toolsをインストールしますが,最近はopen-vm-toolsというオープンソースのものが推奨されている*2ようですので,これを使います.

$ sudo apt-get install open-vm-tools-desktop

これで以下のパッケージがインストールされます.

The following additional packages will be installed:
  dkms libdumbnet1 libgtkmm-2.4-1v5 libmspack0 open-vm-tools
  open-vm-tools-dkms zerofree
The following NEW packages will be installed:
  dkms libdumbnet1 libgtkmm-2.4-1v5 libmspack0 open-vm-tools
  open-vm-tools-desktop open-vm-tools-dkms zerofree

インストールが完了したら再起動します.VMware Fusionの設定画面から共有フォルダを有効にします.

f:id:atsuhiro-me:20161223141140p:plain:w300

以下を実行します.

$ mkdir ~/share
$ /usr/bin/vmhgfs-fuse -o auto_unmount .host:/ ~/share

これで,ホームディレクトリのshareというフォルダーにMacのフォルダーがマウントされました.

f:id:atsuhiro-me:20161223141610p:plain:w300

あとは/etc/rc.local に登録して起動時に自動実行するように設定すれば完了です.