在 Linux 虚拟机中手动安装或升级 VMware Tools

对于 Linux 虚拟机,您可以使用命令行工具手动安装或升级 VMware Tools。

本次Linux 虚拟机为CentOS6.5


先决条件
开启虚拟机。
确认客户机操作系统正在运行。
由于 VMware Tools 安装程序是使用 Perl 编写的,因此,请确认在客户机操作系统中安装了 Perl。

安装VMware Tools的目的

VMware Tools是VMware虚拟机中自带的一种增强工具,相当于VirtualBox中的增强功能(Sun VirtualBox Guest Additions),是VMware提供的增强虚拟显卡和硬盘性能、以及同步虚拟机与主机时钟的驱动程序。
只有在VMware虚拟机中安装好了VMware Tools,才能实现主机与虚拟机之间的文件共享,同时可支持自由拖拽的功能,鼠标也可在虚拟机与主机之前自由移动(不用再按ctrl+alt),且虚拟机屏幕也可实现全屏化。

步骤
1、在主机上,从 Workstation Pro 菜单栏中选择虚拟机 > 安装 VMware Tools。
如果安装了早期版本的 VMware Tools,则菜单项是更新 VMware Tools。
2、在虚拟机中,以 root 身份登录到客户机操作系统并打开终端窗口。

3、不带参数运行 mount 命令以确定 Linux 发行版是否自动装载 VMware Tools 虚拟 CD-ROM 映像。
如果装载了 CD-ROM 设备,将按以下方式列出 CD-ROM 设备及其装载点:
/dev/cdrom on /mnt/cdrom type iso9660 (ro,nosuid,nodev)

 

到此步骤时,我遇到了一个问题,纠结了好久:

就是我通过mount /dev/sr0 /mnt 命令挂载光驱(即把CentOS CDROM挂载在/mnt目录中,就可以访问被里面的内容了),可是我在mnt目录下却看不到东西。

这是什么原因呢?

原来是因为我挂载的/nmt分区已经挂载,所以才会出现上述情况!!!

 解决方法:先umount /mnt 卸载掉   然后 mount /dev/sr0 /mnt

附注:下图红框中的提示是正常的.无需解决.

/dev/sr0写保护,以只读方式挂载。
mount命令默认以读写方式挂载一个设备,而光盘是只读的,所以在挂载光盘这个块设备时会出现上述从读写方式切换为以只读方式挂载光盘的提示。如果不想看到这个提示,就请在mount命令后面添加参数,指定以只读方式来挂载设备。

接下来的步骤:

4、转到工作目录,例如 /tmp/

5、解压缩安装程序。

tar zxpf /mnt/cdrom/VMwareTools-x.x.x-yyyy.tar.gz
x.x.x 值是产品版本号,yyyy 是产品版本的内部版本号。
如果尝试安装 tar 安装以覆盖 RPM 安装或相反,安装程序将检测以前的安装并且必须转换安装程序数据库格式,然后才能继续操作。

6、会发现目录下多了个文件夹vmware-tools-distrib,里面有一个vmware-install.pl文件

7、使用./vmware-install.pl来执行文件

[root@localhost mnt]# cd ../..
[root@localhost /]# cd /tmp
[root@localhost tmp]# ls
keyring-0Xytmd  keyring-hyGJPh  keyring-UvmLHe      virtual-carsonzhu.FBAXXT
keyring-4WJiO6  keyring-Hzpfne  orbit-carsonzhu     virtual-carsonzhu.YLd5ur
keyring-Dtts8C  keyring-nPu72R  orbit-gdm
keyring-fRCtRE  keyring-P2Kgdv  pulse-JJ4pstxF4ptg
keyring-GgwNeg  keyring-tLjlND  pulse-rR5aSeUpvxJC
[root@localhost tmp]# cd /mnt
[root@localhost mnt]# cp VMwareTools-10.0.0-2977863.tar.gz /tmp
[root@localhost mnt]# cd /tmp
[root@localhost tmp]# ls
keyring-0Xytmd  keyring-Hzpfne   orbit-gdm
keyring-4WJiO6  keyring-nPu72R   pulse-JJ4pstxF4ptg
keyring-Dtts8C  keyring-P2Kgdv   pulse-rR5aSeUpvxJC
keyring-fRCtRE  keyring-tLjlND   virtual-carsonzhu.FBAXXT
keyring-GgwNeg  keyring-UvmLHe   virtual-carsonzhu.YLd5ur
keyring-hyGJPh  orbit-carsonzhu  VMwareTools-10.0.0-2977863.tar.gz
[root@localhost tmp]# tar zxpf VMwareTools-10.0.0-2977863.tar.gz
[root@localhost tmp]# ls
keyring-0Xytmd  keyring-nPu72R      pulse-rR5aSeUpvxJC
keyring-4WJiO6  keyring-P2Kgdv      virtual-carsonzhu.FBAXXT
keyring-Dtts8C  keyring-tLjlND      virtual-carsonzhu.YLd5ur
keyring-fRCtRE  keyring-UvmLHe      VMwareTools-10.0.0-2977863.tar.gz
keyring-GgwNeg  orbit-carsonzhu     vmware-tools-distrib
keyring-hyGJPh  orbit-gdm
keyring-Hzpfne  pulse-JJ4pstxF4ptg
[root@localhost tmp]# cd vmware-tools-distrib
[root@localhost vmware-tools-distrib]# ls
bin  doc  FILES    installer  vgauth             vmware-install.real.pl
caf  etc  INSTALL  lib        vmware-install.pl
[root@localhost vmware-tools-distrib]# ./vmware-install.pl

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] 

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? 
[/usr/sbin] 

In which directory do you want to install the library files? 
[/usr/lib/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] 
In which directory do you want to install the common agent library files? 
[/usr/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? 
[/usr/share/doc/vmware-tools] 
The path "yes" is a relative path. Please enter an absolute path.

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] 

The installation of VMware Tools 10.0.0 build-2977863 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] 

Initializing...


Making sure services for VMware Tools are stopped.

Stopping Thinprint services in the virtual machine:
   Stopping Virtual Printing daemon:                                   done
Stopping VMware Tools services in the virtual machine:
   Guest operating system daemon:                          [确定]
   VMware User Agent (vmware-user):                        [确定]
   Unmounting HGFS shares:                                 [确定]
   Guest filesystem driver:                                [确定]


Found a compatible pre-built module for vmci.  Installing it...


Found a compatible pre-built module for vsock.  Installing it...


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] 

Could not create the '/mnt/hgfs' directory.  Please make sure it is writeable 
and/or not currently in use.
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 ] 

Found a compatible pre-built module for vmxnet.  Installing it...


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?
[yes] 

VMware automatic kernel modules enables automatic building and installation of
VMware kernel modules at boot that are not already present. This feature can
be enabled/disabled by re-running vmware-config-tools.pl.

Would you like to enable VMware automatic kernel modules?
[no] 

Thinprint provides driver-free printing. Do you wish to enable this feature? 
[yes] 


Disabling timer-based audio scheduling in pulseaudio.

Do you want to enable Guest Authentication (vgauth)? Enabling vgauth is needed 
if you want to enable Common Agent (caf). [yes] 

Do you want to enable Common Agent (caf)? [yes] 



Detected X server version 1.13.0



Distribution provided drivers for Xorg X server are used.

Skipping X configuration because X drivers are not included.

Creating a new initrd boot image for the kernel.
Generating the key and certificate files.
Successfully generated the key and certificate files.
   Starting Virtual Printing daemon:                                   done
   Checking acpi hot plug                                  [确定]
Starting VMware Tools services in the virtual machine:
   Switching to guest configuration:                       [确定]
   VM communication interface:                             [确定]
   VM communication interface socket family:               [确定]
   Blocking file system:                                   [确定]
   Guest operating system daemon:                          [确定]
   VGAuthService:                                          [确定]
   Common Agent:                                           [确定]
The configuration of VMware Tools 10.0.0 build-2977863 for Linux for this 
running kernel completed successfully.

You must restart your X session before any mouse or graphics changes take 
effect.

You can now run VMware Tools by invoking "/usr/bin/vmware-toolbox-cmd" from the
command line.

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; and,
3. Restart your X session.

Enjoy,

--the VMware team

Found VMware Tools CDROM mounted at /media/VMware Tools. Ejecting device 
/dev/sr0 ...
Found VMware Tools CDROM mounted at /mnt. Ejecting device /dev/sr0 ...

8、紧接着输入命令reboot重启就好了!  

 

附:修改虚拟机中linux系统的分辨率

 

posted @ 2016-05-17 22:19  小金乌会发光-Z&M  阅读(30502)  评论(1编辑  收藏  举报