VMvare CentOS7 设置共享文件夹的方式

 

VMvare 对CentOS7 设置共享文件夹 与一些版本有所区别。在设置共享文件夹的时候 遇到了一些坑,记录一下。

 

Step 1 设置共享文件夹

Step2 安装依赖包

Step3 重新安装VMwareTools  ,  修改CD-ROM 加载的文件

Step4 安装VMware Tools

Step5 挂起客户机 ..尴尬的步骤

Step6 检查共享文件夹是否能被扫描到

Step7 挂载共享文件夹 vmhgfs-fuse

Ext 常见错误 与解决方案

 

写在前面: 

当你以为 CentOS7 下 安装 VMware-Tools 可以直接通过 图形界面直接安装完成时,那就大错特错了,请你仔细读完这篇文章!!!!

错误方式:

 

 

 

Step 1 设置共享文件夹

 

该步骤主要是从 VMware 通过界面 方式设置 共享文件夹,该步骤没什么难度,贴个截图作为代表。

 

 

Step2 安装依赖包

 

主要进行以下两个步骤的安装:

 

yum -y install kernel-devel-$(uname -r) 

yum -y install net-tools perl gcc gcc-c++

 

 

 

 

Step3 重新安装VMwareTools  , 修改CD-ROM 加载的文件

 

先从虚拟机上选择重新安装 VMware Tools

 

再选择,cd-rom 加载的 cd 镜像。

一般来说,我们的 CD-ROM, 此时加载Linux 系统的安装 iso,我们需要改为 Linux 工具包的 iso

 

 

 

选择为 VMware 对应目录下的 iso 文件。 我们这里是 Linux系统,选择为linux.iso。

对应的目录是: D:\Program Files (x86)\VMware\VMware Workstation

 

 

 

 

Step4 安装VMware Tools

 

好了,此时我们可以去安装 VMware Tools 了

我们首先将磁盘目录 挂载到我们一个真实目录上

 

mount /dev/cdrom /home/tmp

cp /home/tmp/VMwareTools-9.6.0-1294478.tar.gz /tmp
cd /tmp

tar -zxvf VMwareTools-9.6.0-1294478.tar.gz

cd vmware-tools-distrib

./vmware-install.pl

一直回车即可,

安装好后,会自动在 /mnt 下创建 hgfs 目录

 

 

Step5 挂起客户机 ..尴尬的步骤

 

此时我们已经安装好了 VMware Tools ,按理说应该能检测到 可以被加载的 目录了,但是 发现加载不到.

查找了 各种文档,最后发现此时 需要将 虚拟机挂起。

 

 

Step6 检查共享文件夹是否能被扫描到

 

通过   vmware-hgfsclient   指令去检查 ,共享文件夹是否能被找到    

例如我就设置了两个共享文件夹

[root@cdh-manager vmware-tools-distrib]# vmware-hgfsclient
Share_Windows_Linux
Share_Dir_SSD

 

Step7 挂载共享文件夹 vmhgfs-fuse

这时不能用mount工具挂载,而是得用vmhgfs-fuse,需要安装工具包

yum install open-vm-tools-devel -y
有的源的名字并不一定为open-vm-tools-devel(centos) ,而是open-vm-dkms(unbuntu)
执行:vmhgfs-fuse .host:/ /mnt/hgfs

 

 

Ext 常见错误 与解决方案

 

 

 

问题1 

挂载共享文件夹使用   mount -t vmhgfs .host:/ /mnt/hgfs

 

/mnt/hgfs但没有共享文件的解决方法:

mount -t vmhgfs .host:/  /mnt/hgfs
Error: cannot mount filesystem: No such device

参看步骤 7 挂载,使用替代指令

yum install open-vm-tools-devel -y
有的源的名字并不一定为open-vm-tools-devel(centos) ,而是open-vm-dkms(unbuntu)
执行:vmhgfs-fuse .host:/ /mnt/hgfs

 

问题2

安装 VMware Tools 时报 客户机操作系统已将 CD-ROM 门锁定,并且可能正在使用CD-ROM

https://www.linuxidc.com/Linux/2016-04/130806.htm

 

问题3 

找不到 kernel-devel 包

[root@cdh-repo yum.repos.d]# yum -y install kernel-devel-$(uname -r)
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.neusoft.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
No package kernel-devel-3.10.0-862.14.4.el7.x86_64 available.

 

方案1:

请使用 yum update 更新内核, 并重启电脑

 

方案2:

安装 epel 源

----EPEL

EPEL(Extra Packages for Enterprise Linux)是由 Fedora 社区打造,为 RHEL 及衍生发行版如 CentOS等提供高质量软件包的项目。装上了 EPEL,就像在 Fedora 上一样,可以通过 yum install 软件包名,即可安装很多以前需要编译安装的软件、常用的软件或一些比较流行的软件,比如现在流行的nginx、htop、ncdu、vnstat等等,都可以使用EPEL很方便的安装更新。

目前可以直接通过执行命令: yum install epel-release 直接进行安装,如果此命令无法安装可以尝试以下方法

安装之后执行以下指令:

yum clean all
yum makecache 

 

问题4 

vmware-tools 已经安装,需要先卸载,再安装

[root@cdh-repo vmware-tools-distrib]# ./vmware-install.pl
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


rpm -e --nodeps open-vm-tools
再继续安装

 

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值