首页 > 技术文章 > Ubuntu16在VMWare中使用共享文件夹

91program 2016-08-26 08:38 原文

安装 VMWare-tools 后共享文件夹一直无法使用,在网上折腾了好多方法,最后发现成功了。

多安装几次 VMWare-tools 吧,正确的时候如下:

leozheng@ubuntu:~/Desktop$ cd vmware-tools-distrib/
leozheng@ubuntu:~/Desktop/vmware-tools-distrib$ ls
bin  caf  doc  etc  FILES  INSTALL  installer  lib  vgauth  vmware-install.pl  vmware-install.real.pl
leozheng@ubuntu:~/Desktop/vmware-tools-distrib$ sudo ./vmware-install.pl 
[sudo] password for leozheng: 
The installer has detected an existing installation of open-vm-tools on this 
system and will not attempt to remove and replace these user-space 
applications. It is recommended to use the open-vm-tools packages provided by 
the operating system. If you do not want to use the existing installation of 
open-vm-tools and attempt to install VMware Tools, you must uninstall the 
open-vm-tools packages and re-run this installer.
The packages that need to be removed are:
open-vm-tools
The installer will next check if there are any missing kernel drivers. Type yes
if you want to do this, otherwise type no [yes] 

A previous installation of VMware Tools has been detected.

The previous installation was made by the tar installer (version 4).

Keeping the tar4 installer database format.

You have a version of VMware Tools installed.  Continuing this install will 
first uninstall the currently installed version.  Do you wish to continue? 
(yes/no) [yes] 

Uninstalling the tar installation of VMware Tools.

Stopping services for VMware Tools

Stopping VMware Tools services in the virtual machine:
   VMware User Agent (vmware-user):                                    done
   Unmounting HGFS shares:                                             done
   Guest filesystem driver:                                            done

Stopping Thinprint services in the virtual machine:
   Stopping Virtual Printing daemon:                                   done

The removal of VMware Tools 10.0.0 build-2977863 for Linux completed 
successfully.

Installing VMware Tools.

In which directory do you want to install the binary files? 
[/usr/bin] 

What is the directory that contains the init directories (rc0.d/ to rc6.d/)? 
[/etc] 

What is the directory that contains the init scripts? 
[/etc/init.d] 

In which directory do you want to install the daemon files? 
[/usr/sbin] 

In which directory do you want to install the library files? 
[/usr/lib/vmware-tools] 

The path "/usr/lib/vmware-tools" does not exist currently. This program is 
going to create it, including needed parent directories. Is this what you want?
[yes] 

In which directory do you want to install the documentation files? 
[/usr/share/doc/vmware-tools] 

The path "/usr/share/doc/vmware-tools" does not exist currently. This program 
is going to create it, including needed parent directories. Is this what you 
want? [yes] 

The installation of VMware Tools 10.0.0 build-2977863 for Linux completed 
successfully. You can decide to remove this software from your system at any 
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".

Before running VMware Tools for the first time, you need to configure it by 
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want 
this program to invoke the command for you now? [yes] 

The file /usr/bin/vmware-hgfsclient that this program was about to install 
already exists.  Overwrite? [no] yes

The file /usr/bin/vmhgfs-fuse that this program was about to install already 
exists.  Overwrite? [no] yes

Initializing...


Making sure services for VMware Tools are stopped.

Stopping Thinprint services in the virtual machine:
   Stopping Virtual Printing daemon:                                   done
Stopping VMware Tools services in the virtual machine:
   VMware User Agent (vmware-user):                                    done
   Unmounting HGFS shares:                                             done
   Guest filesystem driver:                                            done


update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
The module vmci has already been installed on this system by another installer 
or package and will not be modified by this installer.

The module vsock has already been installed on this system by another installer
or package and will not be modified by this installer.

The module vmxnet3 has already been installed on this system by another 
installer or package and will not be modified by this installer.

The module pvscsi has already been installed on this system by another 
installer or package and will not be modified by this installer.

The module vmmemctl has already been installed on this system by another 
installer or package and will not be modified by this installer.

The VMware Host-Guest Filesystem allows for shared folders between the host OS 
and the guest OS in a Fusion or Workstation virtual environment.  Do you wish 
to enable this feature? [yes] 

The vmxnet driver is no longer supported on kernels 3.3 and greater. Please 
upgrade to a newer virtual NIC. (e.g., vmxnet3 or e1000e)

VMware automatic kernel modules enables automatic building and installation of
VMware kernel modules at boot that are not already present. This feature can
be enabled/disabled by re-running vmware-config-tools.pl.

Would you like to enable VMware automatic kernel modules?
[yes] 

Thinprint provides driver-free printing. Do you wish to enable this feature? 
[yes] 

Creating a new initrd boot image for the kernel.
update-initramfs: Generating /boot/initrd.img-4.4.0-21-generic
   Starting Virtual Printing daemon:                                   done
   Checking acpi hot plug                                              done
Starting VMware Tools services in the virtual machine:
   Switching to guest configuration:                                   done
   VMware Automatic Kmods:                                             done
   Guest filesystem driver:                                            done
   Mounting HGFS shares:                                               done
   VMware User Agent:                                                  done
The configuration of VMware Tools 10.0.0 build-2977863 for Linux for this 
running kernel completed successfully.

Enjoy,

--the VMware team

leozheng@ubuntu:~/Desktop/vmware-tools-distrib$ 
leozheng@ubuntu:~/Desktop/vmware-tools-distrib$ lsmod | grep vm
vmw_vsock_vmci_transport    32768  0
vsock                  32768  1 vmw_vsock_vmci_transport
vmw_balloon            20480  0
vmw_vmci               61440  2 vmw_vsock_vmci_transport,vmw_balloon
vmw_pvscsi             24576  0
vmxnet3                49152  0
vmwgfx                204800  3
ttm                    90112  1 vmwgfx
drm_kms_helper        131072  1 vmwgfx
drm                   311296  6 ttm,drm_kms_helper,vmwgfx

lsmod 的执行结果中还是没有 vmhgfs!但是 /mnt/hgfs 中已经出现了共享目录。

推荐阅读