在 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系統的分辨率

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM