安装VMWare tools,踩坑。记录一下

对于没钱买服务器的小白,只能靠安装虚拟机来勉强度日子。
最近比较闲,想实现一下docker的自动化部署,在制作java8镜像时出了个问题。
就是怎么在虚拟机上实现与本机文件夹的共享。

坑了2天。记录一下,环境 VMware® Workstation 12 Pro + CentOS 

1. 首先是 CD/DVD(SATA) 这里的话 选择VMan安装目录的 linux.iso (C:\Program Files (x86)\VMware\VMware Workstation\linux.iso)

这里选择这个 是因为这里包含了 一些工具包,(https://www.linuxidc.com/Linux/2016-04/130806.htm)

技术图片

选好后 ,打开虚拟机。技术图片

由于这里以及安装过了,所以是 重新安装。
点击安装后,会弹出一个框。

客户机操作系统已将 CD-ROM 门锁定,并且可能正在使用 CD-ROM,这可能会导致客户机无法识别介质的更改。如果可能,请在断开连接之前从客户机内部弹出 CD-ROM。确实要断开连接并覆盖锁定设置吗?

这个可以无视,不过。点了后。连接的虚拟机就不能用了。

2. 输入如下命令 
[[email protected] ~]# mkdir /mnt/cdrom --创建文件夹
输入 注意空格 
[[email protected] ~]#mount /dev/cdrom /mnt/cdrom/  -- 通俗地理解为将iso文件 挂载到 /mnt/cdrom 文件夹下

3。进入/mnt/cdrom 会出现一堆文件。
[[email protected] ~]# cd /mnt/cdrom/  

[[email protected] cdrom]# ls

技术图片

主要是那个红色的文件。将气拷贝至其他目录路

cp VMWareTools-10.0.10-4301679.tar.gz /home/VMWareTools-10.0.10-4301679.tar.gz

4. 进入目录/home,解压VMWareTools-10.0.10-4301679.tar.gz,解压后出现vmware-tools-distrib

  cd /home

  tar -zxf  VMWareTools-10.0.10-4301679.tar.gz

技术图片

5.进入目录vmware-tools-distrib,运行安装文件./vmware-install.pl ,这里如果没有编译环境会报错(bash: ./vmware-install.pl: /usr/bin/perl: bad interpreter: ......)。

则需要安装  yum install perl gcc kernel-devel  安装后。在运行安装文件./vmware-install.pl

有[yes] 直接输入yes, 没有的直接回车。只到出现了一个重复的问题。以下是安装日志。

open-vm-tools packages are available from the OS vendor and VMware recommends
using open-vm-tools packages. See http://kb.vmware.com/kb/2073803 for more
information.
Do you still want to proceed with this installation? [yes] 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

Uninstalling the tar installation of VMware Tools.

ValueError: 未定义 /sbin/vmtoolsd 的文件上下文
semanageFcontext: unable to set SELinux fcontext - command: "semanage fcontext
-d /sbin/vmtoolsd"
There was an error removing the local SELinux security context for VMware
Tools. Please make certain SELinux is set up correctly.

Stopping services for VMware Tools

 

This program previously created the file
/lib/vmware-tools/lib64/libconf/etc/gtk-2.0/gdk-pixbuf.loaders, and was about
to remove it. Somebody else apparently did it already.

This program previously created the file
/lib/vmware-tools/lib64/libconf/etc/gtk-2.0/gtk.immodules, and was about to
remove it. Somebody else apparently did it already.

The removal of VMware Tools 10.1.6 build-5214329 for Linux completed
successfully.

Installing VMware Tools.

In which directory do you want to install the binary files?
[/vm-tools]

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

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

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

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

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

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

In which directory do you want to install the common agent library files?
[/lib]

In which directory do you want to install the common agent transient files?
[/var/lib]

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

The path "/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

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

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

Initializing...


Making sure services for VMware Tools are stopped.

 

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


Before you can compile modules, you need to have the following installed...

make
gcc
kernel headers of the running kernel


Searching for GCC...
Detected GCC binary at "/bin/gcc".
The path "/bin/gcc" appears to be a valid path to the gcc binary.
Would you like to change it? [no] no

Searching for a valid kernel header path... --这里要输入刚刚安装的repl 的include
The path "" is not a valid path to the 3.10.0-957.el7.x86_64 kernel headers.
Would you like to change it? [yes] yes

Enter the path to the kernel header files for the 3.10.0-957.el7.x86_64
kernel?

The path "" is not a valid path to the 3.10.0-957.el7.x86_64 kernel headers.
Would you like to change it? [yes] yes

Enter the path to the kernel header files for the 3.10.0-957.el7.x86_64
kernel? ""

Enter the path to the kernel header files for the 3.10.0-957.el7.x86_64
kernel? /usr/src/kernels/3.10.0-957.5.1.el7.x86_64/include

The path "/usr/src/kernels/3.10.0-957.5.1.el7.x86_64/include" is not a valid
path to the 3.10.0-957.el7.x86_64 kernel headers.


Would you like to change it? [yes] no

WARNING: This program cannot compile any modules for the following reason(s)...

- This program could not find a valid path to the kernel headers of the running
kernel. Please ensure that the header files for the running kernel are
installed on this sytem.

[ Press Enter key to continue ]


The filesystem driver (vmhgfs module) is used only for the shared folder
feature. The rest of the software provided by VMware Tools is designed to work
independently of this feature.

If you wish to have the shared folders feature, you can install the driver by
running vmware-config-tools.pl again after making sure that gcc, binutils, make
and the kernel sources for your running kernel are installed on your machine.
These packages are available on your distribution‘s installation CD.
[ Press Enter key to continue ] ...... 

后面yes 回车,输入即可,只到。

技术图片

这里就OK啦。然后重启虚机。 reboot ;

设置共享文件夹。 虚拟机-》设置-》选项。

技术图片

 

此时在linux中进入 /mnt/hgfs 文件夹,但发现共享的文件没有显示  继续。

[[email protected] ~]$ vmware-hgfsclient
-bash: vmware-hgfsclient: 未找到命令
[[email protected] ~]$ mount -t vmhgfs .host:/vm-share /mnt/hgfs  
mount: 只有 root 用户能使用“--types”选项
[[email protected] ~]$ sudo mount -t vmhgfs .host:/vm-share /mnt/hgfs (红字是共享文件夹名称)
[sudo] temp 的密码:
Error: cannot mount filesystem: No such device(如提示该错误)
[[email protected] ~]$ sudo yum install open-vm-tools (安装 yum install open-vm-tools)

完成后 。在执行 vmhgfs-fuse .host:/ /mnt/hgfs 

技术图片

就有共享文件夹啦。

安装VMWare tools,踩坑。记录一下


推荐文章
Hibernate的increment主键生成机制带来的问题

      最近给学校做的系统,总出现主键插入冲突的问题。主键是通过hibernate自动生成的,设置increment属性,总出现Duplicate entry的错误。搜到解决方案如下:     

linux基础命令学习(一)

pwd输出当前工作路径tree以树状图列出目录的内容ctrl+c取消命令的执行clear 清空屏幕ls列出文件目录蓝色是目录,白色是普通文件aliascls=clear 别名终端:本地终端、远程虚

Mac的Safari安装油猴插件(Tampermonkey)

Mac的Safari安装油猴插件(Tampermonkey)官方的AppStore是没有油猴插件(Tampermonkey)的,官方插件不仅少,功能被阉割,相对弱小,还收费。嗯,这很苹果第三方拓展。这

ubuntu配置静态路由及重启生效

ubuntu配置静态路由及重启生效第一种方法:使用route命令(添加临时路由)添加到主机的路由#routeadd-host192.168.1.123deveth0#routeadd-host192.

vmware中ubuntu系统扩展磁盘

总体思路:对新增硬盘进行分区(新硬盘可以直接增加逻辑分区挂载目录,老硬盘先删除逻辑分区重新分区再挂载目录),对逻辑分区再进行目录挂载。虚拟机中ubuntu系统扩展磁盘有两种方式:一、添加一块新硬盘,对

kali linux 2019.4设置为中文方法

就在前天,2019年11月26日,kaliLinux官网发布了最新版本:KaliLinux2019.4发行版,此版本和之前相比变动很大,系统界面、主题、壁纸都灿然一新。Kali Linux2019.4

关于eclipse的Description:Resource Path Location Type The project cannot be built until build path errors are resolved的问题

问题如上一开始安装也有问题,安装完打不开显示出错,打开eclipe的安装目录,找到eclipse.ini,在最后加上后面这么一行就好了。--add-modules=ALL-SYSTEM百度了一下,发现

linux目录结构

Linux根目录(/) FHS认为,Linux系统的根目录(/)最为重要(没有之一),其原因有以下2点: 所有目录都是由根目录衍生出来的; 根目录与系统的开机、修复、还原密切相关;因此,根目录必须包含

VMware workstation 14永久激活密钥、注册码

VMwareworkstation14永久激活密钥、注册码CG54H-D8D0H-H8DHY-C6X7X-N2KG6ZC3WK-AFXEK-488JP-A7MQX-XL8YFAC5XK-0ZD4H-0

Ubuntu20.4安装

官网下载镜像https://releases.ubuntu.com/20.04/ubuntu-20.04-live-server-amd64.iso挂载开装选语言选键盘网络设置DHCP到地址代理设置空

【Linux学习】Ubuntu下内核编译(一)

(1)当要执行内核配置时,输入makemenuconfig时出现错误 遇到这个问题,主要是以为没有ncurses库,而makemenconfig需要这个库,因此需要安装ncurses或者ncurse

《SLAM机器人基础教程》第五章 Linux基础

第五章Linux基础本章基于树莓派,以ubuntu为例讲解Linux。本章内容规划:5.1节,Linux概述5.2节,系统安装5.3节,Linux指令及ubuntu的使用5.4节,SSH和VNC5.5

ubuntu防火墙

安装方法 sudoapt-getinstallufw 当然,这是有图形界面的(比较简陋),在新立得里搜索gufw试试……使用方法1启用 sudoufwenable sudoufwdefaultden

《鸟哥linux》--第十一章课后习题答案

1.在linux上可以找到哪些shell?哪个档案记录可用的shell?儿linux预设的shell是?  1./bin/bash,/bin/tcsh,/bin/csh  2./etc/shells 

linux和ubuntu区别是什么?有什么关系?

  Ubuntu:是一个以桌面应用为主的开源gnu、Linux操作系统,Ubuntu是基于DebianGNU/Linux,支持x86、amd64(即x64)和ppc架构。首个版本Ubuntu以Debi

Linux下设置环境变量

setenv(setenvironment variable)功能说明:查询或显示环境变量。语  法:setenv [变量名称][变量值]补充说明:setenv为tsch中查询或设置环境变量的指令。

关于在linux系统下安装jdk

    今天装jdk遇到了不少的问题,我第一次遇到64位虚拟机中居然装32位操作系统,然后遇到一系列的麻烦,差点有种崩溃的感觉; 对于版本为题是一个很关键的问题,对于jdk安装,不要认为只要java

Linux iconv使用

iconv[选项】文件输入/输出格式规范:-f, --from-code=名称原始文本编码-t,--to-code=名称 输出编码信息:-l,--list 列举所有已知的字符集输出控制:-c

Linux # kubuntu 14.04 登陆界面乱码,停止,进不了系统

问题描述:             kubuntu14.04登陆界面乱码,停止,进不了系统分析思路: 解决过程: 问题总结: 参考: lubuntu登陆界面乱码,如何解决?-查看主题?Ubuntu中

在Eclipse或者STS中使用SVN插件

在Eclipse/STS安装SVN插件  在STS4中默认是没有SVN插件的,需要我们手动安装SVN插件安装有两种方式,一种是在线安装,一种是离线安装但是在线安装,由于网络问题,一般很难安装成功,所以