赞
踩
最近,遇到了一个很糟心的问题:我没办法将 Ubuntu 虚拟机中的文件复制粘贴到 Windows 主机中,或者说我无法通过 Windows 主机访问 Ubuntu 虚拟机中的文件。
经过搜索,我发现共享文件夹可以实现虚拟机和主机间的文件共享。
点击虚拟机软件最上方的菜单栏:
虚拟机->设置->选项,启用共享文件夹,并配置它在主机中的路径。
顺利的话,你会在/mnt/hgfs
下发现你刚刚配置好的共享文件夹。我的共享文件夹是 sharey。
不顺利的话,/mnt
下将没有任何文件。
如果你是这样的情况,那么可以接着往下看了。
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
共享文件夹出现了。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。