VMware实现主机与虚拟机ubuntu之间的文件共享

说明

本文介绍通过__VMware共享工具__如何实现主机与虚拟机之间的文件共享,这样就可以很方便的在windows中编辑代码,然后在共享文件夹下自动完成文件的上传和下载。

工具版本

  • VMware® Workstation 15 Pro——15.5.1 build-15018445
  • ubuntu 64 18.04

安装VMware-Tool 工具

  1. 先关闭虚拟机,然后按照 “虚拟机-》重新安装VMware Tools” 一次点击,然后打开虚拟机,开机的过程中出现下面对话表示正在安装工具;
    01
  2. 进入桌面,挂载VMware Tools DVD虚拟文件,用终端打开,解压文件,进入解压文件目录
daydream@ubuntu:$  tar -xzvf VMwareTools-10.3.10-13959562.tar.gz -C /home/daydream/Desktop
daydream@ubuntu:$  cd /home/daydream/Desktop/vmware-tools-distrib/

02
3. 运行安装程序,安照安装步骤执行即可(路径选择默认即可)

daydream@ubuntu:$ sudo ./vmware-install.pl
  1. 重启虚拟机
daydream@ubuntu:$ reboot

配置主机共享文件夹路径

  1. 如下图所示,按照“编辑虚拟机设置-》选项-》共享文件夹-》总是启用-》添加-》”依次选择,然后在弹出的对话框中点击“下一步”;4-01
  2. 接下来配置路径。“主机路径”是主机中共享的文件夹路径,名称是共享到虚拟机中文件的名称;
    在这里插入图片描述
  3. 接着在__/mnt/hgfs__路径下就可以看到共享文件夹。
daydream@ubuntu:/mnt/hgfs$ ls -a
.  ..  ubuntu18.04_file_sys

问题

问题1 :“重新安装VMware Tools”选项变灰

解决方法

关闭虚拟机,选择“编辑虚拟机设置”,选择弹出的对话框中的"硬件";

  1. 添加CD/DVD驱动器
  2. 添加软盘驱动器
  3. 在开启虚拟机的过程中选项“重新安装VMware Tools”会变得可选中,
    注意: 只有在开机过程中才能选中,开机后文件就自动安装了
    问题1-01

问题2 :如果已经安装了VMware工具,安装时报错:

daydream@ubuntu:/tmp/vmware-tools-distrib$ sudo ./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
Packages must be removed with the --purge option.
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

INPUT: [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] yes

INPUT: [yes]

Error: Unable to execute "/usr/bin/vmware-uninstall-tools.pl.

Uninstall failed.  Please correct the failure and re run the install.

Execution aborted.

daydream@ubuntu:/tmp/vmware-tools-distrib$ 

出现这种的原因是 安装时会先删除已经存在的安装文件,但是删除程序并没有在路径/usr/bin/中

解决方法:
daydream@ubuntu:$ cd vmware-tools-distrib/bin/
daydream@ubuntu:$ sudo cp -r vmware-uninstall-tools.pl /usr/bin/

参考链接

https://www.cnblogs.com/huangjianxin/p/6343881.html
https://blog.csdn.net/Homewm/article/details/92562342

  • 5
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值