分类: Linux
CentOS安装VMwareTools

vmtools有以下功能:

正常执行虚拟机的电源操作。
在执行各种电源操作期间在客户机操作系统中运行 VMware 提供的脚本或用户配置的脚本。
在客户机操作系统中运行应用程序、命令和文件系统操作,以增强客户机自动化。
针对客户机用户操作进行身份验证。
定期从客户机收集网络、磁盘和内存使用情况信息。
生成从客户机操作系统到主机的检测信号,以便 VMware High Availability 可以确定客户机操作系统的可用性。
在客户机操作系统与主机或客户端桌面之间同步时钟。
使客户机文件系统进入静默状态,以便主机可以捕获与文件系统一致的客户机快照。
在使客户机文件系统进入静默状态时,运行 pre-freeze-script.bat 和 post-thaw-script.bat。
打开虚拟机电源后立即自定义客户机操作系统。
在 VMware Workstation 和 VMware Fusion 上,在主机文件系统与客户机文件系统之间启用“共享文件夹”。
支持在客户机操作系统与主机或客户端桌面之间复制和粘贴文本、图形和文件。
没有安装vmtools的虚拟机,通过vsphere client查看虚拟机信息时,是看不到虚拟机IP地址与hostname.

VMware Tools安装步骤:

1、登录vsphere控制台在要安装的虚机上,更改配置,将光驱设置为客户端设备。
1.png
2、右键客户机操作系统--安装VMware Tools
3、ssh登陆要安装的虚机,挂载vmtools镜像
mkdir /root/cdrom
mount /dev/cdrom /root/cdrom

4、解压

cd /root/cdrom
tar zvxf VMwareTools-10.2.1-8267844.tar.gz -C /root/

5、开始安装:

yum install perl -y  #安装perl包
cd /root/cdrom/VMwareTools
./vmware-install.pl 
# 询问是否继续安装,默认为否
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? [no] 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? 
[/usr/bin] 
 
-自动启动文件路径,默认即可
What is the directory that contains the init directories (rc0.d/ to rc6.d/)? 
[/etc/rc.d] 
 
-init文件夹路径,默认即可
What is the directory that contains the init scripts? 
[/etc/rc.d/init.d] 
 
-sbin文件夹路径,默认即可
In which directory do you want to install the daemon files? 
[/usr/sbin] 
 
# vmware-tools库目录路径,默认即可
In which directory do you want to install the library files? 
[/usr/lib/vmware-tools] 
 
# vmware-tools库目录不存在,需要创建,默认即可
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?
[yes] 
 
# agent library文件夹路径,默认即可
In which directory do you want to install the common agent library files? 
[/usr/lib] 
 
# agent transient文件夹路径,默认即可
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? 
[/usr/share/doc/vmware-tools] 
 
# 帮助文档文件夹并不存在,需要创建,默认即可
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] 
 
# 执行configure脚本,默认即可
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] 
 
# 是否启用文件文件夹共享,esxi环境无法使用,默认即可
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? [no] 
 
# vmblock,不支持esxi环境,默认即可
The vmblock enables dragging or copying files between host and guest in a 
Fusion or Workstation virtual environment.  Do you wish to enable this feature?
[no] 
 
# 是否启用VMware automatic kernel modules,默认即可
Would you like to enable VMware automatic kernel modules?
[yes] 
 
# 是否启用vgauth,默认即可
Do you want to enable Guest Authentication (vgauth)? Enabling vgauth is needed 
if you want to enable Common Agent (caf). [yes] 
 
# 是否启用Common Agent,默认即可
Do you want to enable Common Agent (caf)? [no] 
No X install found.
开始安装:

Creating a new initrd boot image for the kernel.
Generating the key and certificate files.
Successfully generated the key and certificate files.
manageSELinux install: The 'semanage' utility was not found.
There was an error configuring the SELinux security context for VMware Tools.  
Please make certain that SELinux is configured correctly.
 
The configuration of VMware Tools 10.2.1 build-8267844 for Linux for this 
running kernel completed successfully.
 
You must restart your X session before any mouse or graphics changes take 
effect.
 
To enable advanced X features (e.g., guest resolution fit, drag and drop, and 
file and text copy/paste), you will need to do one (or more) of the following:
1. Manually start /usr/bin/vmware-user
2. Log out and log back into your desktop session
3. Restart your X session.
 
Enjoy,
 
--the VMware team
 
Found VMware Tools CDROM mounted at /root/cdrom. Ejecting device /dev/sr0 ...

安装完成后会自动卸载cdrom.
6、删除安装包:

rm /root/cdrom /root/VMwareTools -rf

7、查看vmtools服务状态:

systemctl status vmware-tools

参考文档:
https://www.vmware.com/files/cn/pdf/vmware-tools-installation-configuration.pdf
https://ngx.hk/2018/08/22/vmware-tools%E7%AE%80%E4%BB%8B%E4%B8%8E%E5%AE%89%E8%A3%85.html


相关博文:

发表新评论