lunes, 4 de abril de 2016

Instalar VMware Tools en una máquina virtual Linux-Red Hat

Cuando creamos una máquina virtual linux en VMware, la instalación de las VMware Tools no es tan directa como en Windows dado que es habitual tener los servidores linux en un INIT 3 y por tanto la instalación la tendremos que realizar desde la línea de comandos. En los pasos que pongo a continuación, la máquina virtual donde vamos a instalar las VMware Tools tiene un sistema operativo Red Hat y está alojada en un ESXI registrado en un vCenter.

1- Verificamos que no tenemos instaladas las VMware Tools con el siguiente comando:
[root@localhost ~]#  grep buildNr /usr/bin/vmware-config-tools.pl

Si la salida del comando es grep: /usr/bin/vmware-config-tools.pl: No existe el fichero o el directorio es que no las tenemos instaladas. En caso de tenerlas instaladas nos aparecerá una salida similar a esta:

[root@localhost ~]# grep buildNr /usr/bin/vmware-config-tools.pl
  my $buildNr;
  $buildNr = '9.4.10 build-2068191';
  return remove_whitespaces($buildNr);

2- Publicamos en el directorio /dev/cdrom de la máquina virtual las VMware Tools para poder instalarlas. Esto lo podemos realizar conectándonos al vCenter bien con el cliente ligero o bien con el cliente pesado (pongo las capturas de pantalla de cada uno de ellos para que se vean las rutas).:
  • Conectándonos al vCenter que gestiona los ESXI mediante el vSphere Web Client (cliente ligero), pinchando con el botón secundario en VM->Guest->Install/Upgrade VMware Tools en la máquina virtual donde queramos instalarlo.
  • Conectándonos al vCenter que gestiona los ESXI mediante el cliente pesado, pinchando con el botón secundario en VM->Guest->Install/Upgrade VMware Tools en la máquina virtual donde queramos instalarlo.

Al hacer click sobre el botón "Install/Upgrade VMware Tools" o sobre "Install VMware Tools" nos parecerá el siguiente mensaje y tendremos que pinchas en Mount:



3- Nos logamos en la máquina virtual donde hemos publicado las VMware Tools y generamos el directorio /mnt/cdrom donde posteriormente montaremos /dev/cdrom:
root@10.0.10.188's password:
Last login: Sun Apr  3 21:35:26 2016 from rencinar
[root@localhost ~]# mkdir /mnt/cdrom


4- Montamos /dev/cdrom en el directorio /mnt/cdrom/ que hemos creado en el paso anterior:
[root@localhost ~]# mount /dev/cdrom /mnt/cdrom/
mount: dispositivo de bloques /dev/cdrom está protegido contra escritura; se monta como sólo lectura
 


5- Comprobamos que el montaje se ha realizado correctamente y que tenemos un archivo similar a VMwareTools-9.4.tar.gz, que es el que utilizaremos para instalarlas.
[root@localhost ~]# ls /mnt/cdrom/
manifest.txt                       run_upgrader.sh                    VMwareTools-9.4.10-2068191.tar.gz  vmware-tools-upgrader-32           vmware-tools-upgrader-64                        
 


6- Copiamos el archivo VMwareTools-9.4.10-2068191.tar.gz al directorio /tmp/ para extraer su contenido. Tras realizar la extracción se nos generará un conjunto de directorios y dentro del directorio vmware-tools-distrib se encuentra el archivo vmware-install.pl que es el que ejecutaremos para empezar con la instalación:
[root@localhost ~]# cp /mnt/cdrom/VMwareTools-9.4.10-2068191.tar.gz /tmp/                                                                                                                                                       
[root@localhost ~]# cd /tmp/

[root@localhost tmp]# tar xvzf VMwareTools-9.4.tar.gz
[root@localhost tmp]# cd vmware-tools-distrib/
[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 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 9.4.10 build-2068191 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 VMware Tools services in the virtual machine:
   Guest operating system daemon:                          [  OK  ]
   Unmounting HGFS shares:                                 [  OK  ]
   Guest filesystem driver:                                [  OK  ]
The VMware FileSystem Sync Driver (vmsync) allows external third-party backup
software that is integrated with vSphere to create backups of the virtual
machine. Do you wish to enable this feature? [no]
Found a compatible pre-built module for vmci.  Installing it...
Found a compatible pre-built module for vsock.  Installing it...
Found a compatible pre-built module for vmxnet3.  Installing it...
Found a compatible pre-built module for pvscsi.  Installing it...
Found a compatible pre-built module for vmmemctl.  Installing it...
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]
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?
[no]
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]
Detected X version 7.1
Unable to detect guest resolution.
Please choose one of the following display sizes that X will start with:
[1]< 640x480
[2]  800x600
[3]  1024x768
[4]  1280x800
Please enter a number between 1 and 4:
[1] 2
X is running fine with the new config file.
Creating a new initrd boot image for the kernel.
   Checking acpi hot plug                                  [  OK  ]
Starting VMware Tools services in the virtual machine:
   Switching to guest configuration:                       [  OK  ]
   Paravirtual SCSI module:                                [  OK  ]
   Guest memory manager:                                   [  OK  ]
   VM communication interface:                             [  OK  ]
   VM communication interface socket family:               [  OK  ]
   Guest operating system daemon:                          [  OK  ]
The configuration of VMware Tools 9.4.10 build-2068191 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 /mnt/cdrom. Ejecting device /dev/cdrom ...
You have new mail in /var/spool/mail/root


Tras esto tendremos instaladas las VMware Tools. Podremos comprobarlo lanzando el comando propuesto al principio y veremos que la salida ya no será "grep: /usr/bin/vmware-config-tools.pl: No existe el fichero o el directorio" sino algo parecido a esta:

[root@localhost ~]# grep buildNr /usr/bin/vmware-config-tools.pl
  my $buildNr;
  $buildNr = '9.4.10 build-2068191';
  return remove_whitespaces($buildNr);

No hay comentarios:

Publicar un comentario