当前位置:   article > 正文

【亲测有效】解决 Ubuntu 虚拟机无法共享文件夹的问题_ubuntu1804 共享文件夹无法使用

ubuntu1804 共享文件夹无法使用

1. 什么是虚拟机共享文件夹

最近,遇到了一个很糟心的问题:我没办法将 Ubuntu 虚拟机中的文件复制粘贴到 Windows 主机中,或者说我无法通过 Windows 主机访问 Ubuntu 虚拟机中的文件。

经过搜索,我发现共享文件夹可以实现虚拟机和主机间的文件共享。

2. 如何开启虚拟机的共享文件夹

点击虚拟机软件最上方的菜单栏:
虚拟机->设置->选项,启用共享文件夹,并配置它在主机中的路径。
在这里插入图片描述
顺利的话,你会在/mnt/hgfs下发现你刚刚配置好的共享文件夹。我的共享文件夹是 sharey。
在这里插入图片描述
不顺利的话,/mnt下将没有任何文件。
如果你是这样的情况,那么可以接着往下看了。

3. 重新安装 VMware-tools

vmware-tools 可以实现虚拟机的文件共享。我的虚拟机“重新安装 VMware-tools” 是灰色的。
在这里插入图片描述
那么我们就需要找到 VMware-tools 的安装包进行安装了。
在虚拟机的安装目录下,有一个叫 linux.so 的文件,它就是我们需要的文件。
在这里插入图片描述
找到文件后,我们需要将这个镜像文件挂载到虚拟机上。还是点击最上方的菜单栏,
虚拟机->设置->硬件->CD/DVD,连接选择使用 ISO 映像文件,通过浏览打开刚才找到的 linux.so 文件。
在这里插入图片描述
之后重启虚拟机,桌面上就可以看到 VMware Tools 光盘文件了。
在这里插入图片描述
现在打开光盘文件,并解压 VMware tools 压缩包。
在这里插入图片描述
这里有一个值得注意的地方:不要在当前文件夹下解压。否则就会出现如下报错:提示空间不足。
在这里插入图片描述
解决办法也很简单,就是:把压缩包复制或剪切到另一个文件夹下,在另一个文件夹下解压即可。
如下图所示,解压成功。
在这里插入图片描述
之后,打开terminal,cd 到 vmware-tools-distrib, 执行 sudo ./vmware-install.pl

重点来了

一定要覆盖安装。

注意比对安装过程,不是每一步都选择 default 的。有些地方需要输入 yes 。
具体安装过程,参考了 VMware虚拟机设置了共享文件夹却找不到

小伙伴们,千万要小心。因为我输了第二次才成功,一定要认真比对。
最后重启虚拟机,就可以在 /mnt/hgfs下发现你刚刚配置好的共享文件夹了。

[root@bogon vmware-tools-distrib]#  ./vmware-install.pl 
The installer has detected an existing installation of open-vm-tools packages 
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 packages and use 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] yes      1.输入 yes

INPUT: [yes]

Creating a new VMware Tools installer database using the tar4 format.

Installing VMware Tools. In which directory do you want to install the binary files? 2.这里回车默认
[/usr/bin] 

INPUT: [/usr/bin]  default What is the directory that contains the init directories (rc0.d/ to rc6.d/)? 3.回车默认
[/etc/rc.d] 

INPUT: [/etc/rc.d]  default What is the directory that contains the init scripts? 4.回车默认
[/etc/rc.d/init.d] 

INPUT: [/etc/rc.d/init.d]  default

In which directory do you want to install the daemon files? 5.回车默认
[/usr/sbin] 

INPUT: [/usr/sbin]  default

In which directory do you want to install the library files? 6.回车默认
[/usr/lib/vmware-tools] 

INPUT: [/usr/lib/vmware-tools]  default 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? 7.输入 yes [yes] yes

INPUT: [yes] In which directory do you want to install the documentation files? 8.回车默认
[/usr/share/doc/vmware-tools] 

INPUT: [/usr/share/doc/vmware-tools]  default 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] yes                                9.输入 yes             

INPUT: [yes]

The installation of VMware Tools 10.3.21 build-14772444 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] yes         10.输入 yes

INPUT: [yes]

You have chosen to install VMware Tools on top of an open-vm-tools package.  
You will now be given the option to replace some commands provided by 
open-vm-tools.  Please note that if you replace any commands at this time and 
later remove VMware Tools, it may be necessary to re-install the open-vm-tools.

The file /usr/bin/vmware-hgfsclient that this program was about to install 
already exists.  Overwrite? [no] yes   **11.!!!!!注意:这里必须输入 yes**

INPUT: [yes]

The file /usr/bin/vmhgfs-fuse that this program was about to install already 
exists.  Overwrite? [no] yes       **12.!!!!!!注意:这里必须输入 yes**

INPUT: [yes]

Initializing...

Making sure services for VMware Tools are stopped.

Stopping vmware-tools (via systemctl):  [  OK  ]

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] yes   13.输入 yes

INPUT: [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)

Skipping configuring automatic kernel modules as no drivers were installed by 
this installer.

Skipping rebuilding initrd boot image for kernel as no drivers to be included in boot image were installed by this installer.

The configuration of VMware Tools 10.3.21 build-14772444 for Linux for this 
running kernel completed successfully.

Found VMware Tools CDROM mounted at /run/media/tys/VMware Tools. Ejecting 
device /dev/sr0 ...
Enjoy, --the VMware team
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112

共享文件夹出现了。
在这里插入图片描述

参考链接

  1. VMware虚拟机设置了共享文件夹却找不到
  2. 虚拟机中安装VMwareTools出错的解决办法:Not enough free space to extract VMwareTools
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/291484
推荐阅读
相关标签
  

闽ICP备14008679号