lunes, 5 de septiembre de 2011

Linux Red Hat - Utilizacion de yum

La herramienta yum es un administrador de software, tiene como  que realiza y resuelve el análisis de dependencias chequeando los repositorios definidos en /etc/yum.repos.d.

Como primer paso si nuestro equipo no tiene acceso directo a internet y el mismo se realiza mediante un proxy, debemos agregar las siguientes lineas al archivo de configuración /etc/yum.conf

proxy=http://<proxy_server>:80
proxy_username=<proxy_user>
proxy_password=<proxy_user_password>

Ya configurado yum, podemos hacer varias tareas entre ellas
  • listar paquetes/grupos de paquetes, 
  • buscar en el repositorio de paquetes,
  • instalar paquetes junto con todas sus dependencias, 
  • actualizar los paquetes instalados,
  • remover paquetes instalados
NOTA: Si bien en el titulo dice que se trata de Red Hat los ejemplos que voy a incluir en la nota son de una distribucion que es copia binaria de RHEL 6.1

Para listar los paquetes que tenemos instalados podemos correr el siguiente comando

[root@scltest01 ~]# yum list installed
Installed Packages
...
udev.i686           147-2.35.el6     @anaconda-ScientificLinux-201107271553.i386
unzip.i686          6.0-1.el6        @anaconda-ScientificLinux-201107271553.i386
upstart.i686        0.6.5-10.el6     @anaconda-ScientificLinux-201107271553.i386
urw-fonts.noarch    2.4-10.el6       @anaconda-ScientificLinux-201107271553.i386
usbutils.i686       0.86-2.el6       @anaconda-ScientificLinux-201107271553.i386
usermode.i686       1.102-3.el6      @anaconda-ScientificLinux-201107271553.i386
ustr.i686           1.0.4-9.1.el6    @anaconda-ScientificLinux-201107271553.i386
util-linux-ng.i686  2.17.2-12.el6    @anaconda-ScientificLinux-201107271553.i386
valgrind.i686       1:3.6.0-3.el6    @anaconda-ScientificLinux-201107271553.i386
vconfig.i686        1.9-8.1.el6      @anaconda-ScientificLinux-201107271553.i386
...

Puedo preguntarle al yum si tiene cierto paquete instalado. En este caso estoy listando si hay algún paquete con nombre que empiece con nfs.

[root@scltest01 ~]# yum list installed nfs*
Installed Packages
nfs-utils.i686       1:1.2.3-7.el6   @anaconda-ScientificLinux-201107271553.i386
nfs-utils-lib.i686   1.1.5-3.el6     @anaconda-ScientificLinux-201107271553.i386
nfs4-acl-tools.i686  0.3.3-5.el6     @anaconda-ScientificLinux-201107271553.i386


Los parámetros list updates obtenemos que paquetes podemos actualizar

[root@scltest01 ~]# yum list updates
Updated Packages
kernel.i686                         2.6.32-131.12.1.el6              sl-security
kernel-firmware.noarch              2.6.32-131.12.1.el6              sl-security

Los paquetes de RPM se agrupan por "grupo de paquetes" con el parametro grouplist podemos ver el listado.

[root@scltest01 ~]# yum grouplist

Setting up Group Process
Installed Groups:
   Additional Development
   Base
   Client management tools
   Console internet tools
   Debugging Tools
   Desktop Platform
   E-mail server
   Fonts
   Graphical Administration Tools
   Hardware monitoring utilities
   Java Platform
   Large Systems Performance
   Legacy UNIX compatibility
...
Installed Language Groups:
   Arabic Support [ar]
   Armenian Support [hy]
   Georgian Support [ka]
   Hebrew Support [he]
   Inuktitut Support [iu]
   Japanese Support [ja]
   Korean Support [ko]
   Lao Support [lo]
   Tajik Support [tg]
Available Groups:
   Backup Client
   Backup Server
   CIFS file server
   Compatibility libraries
...

Si quisiera instalarle el grupo Backup Server correria

yum groupinstall "Backup Server"
Setting up Group Process
Resolving Dependencies
--> Running transaction check
---> Package amanda-server.i686 0:2.6.1p2-7.el6 will be installed
--> Processing Dependency: amanda = 2.6.1p2-7.el6 for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: perl(Amanda::MainLoop) for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: perl(Amanda::Xfer) for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: perl(Amanda::BigIntCompat) for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: perl(Amanda::Device) for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: perl(Amanda::DB::Catalog) for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: perl(Amanda::Changer) for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: perl(Amanda::Debug) for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: perl(Amanda::Util) for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: perl(Amanda::Config) for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: perl(Amanda::Logfile) for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: perl(Amanda::Constants) for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: librestore-2.6.1p2.so for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: libamanda-2.6.1p2.so for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: libamdevice-2.6.1p2.so for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: perl(Amanda::Process) for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: perl(Amanda::Paths) for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: libamandad-2.6.1p2.so for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: libamserver-2.6.1p2.so for package: amanda-server-2.6.1p2-7.el6.i686
--> Processing Dependency: perl(Amanda::Types) for package: amanda-server-2.6.1p2-7.el6.i686
--> Running transaction check
---> Package amanda.i686 0:2.6.1p2-7.el6 will be installed
--> Processing Dependency: xinetd for package: amanda-2.6.1p2-7.el6.i686
--> Running transaction check
---> Package xinetd.i686 2:2.3.14-31.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package               Arch         Version                    Repository  Size
================================================================================
Installing:
 amanda-server         i686         2.6.1p2-7.el6              sl         467 k
Installing for dependencies:
 amanda                i686         2.6.1p2-7.el6              sl         543 k
 xinetd                i686         2:2.3.14-31.el6            sl         120 k

Transaction Summary
================================================================================
Install       3 Package(s)

Total download size: 1.1 M
Installed size: 3.2 M
Is this ok [y/N]:y 
Downloading Packages:
(1/3): amanda-2.6.1p2-7.el6.i686.rpm                     | 543 kB     00:19 ... 
(2/3): amanda-server-2.6.1p2-7.el6.i686.rpm              | 467 kB     00:05 ... 
(3/3): xinetd-2.3.14-31.el6.i686.rpm                     | 120 kB     00:02 ... 
--------------------------------------------------------------------------------
Total                                            14 kB/s | 1.1 MB     01:21     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 2:xinetd-2.3.14-31.el6.i686                                  1/3 
  Installing : amanda-2.6.1p2-7.el6.i686                                    2/3 
  Installing : amanda-server-2.6.1p2-7.el6.i686                             3/3 

Installed:
  amanda-server.i686 0:2.6.1p2-7.el6                                            

Dependency Installed:
  amanda.i686 0:2.6.1p2-7.el6            xinetd.i686 2:2.3.14-31.el6           

Complete!

Si necesito saber que paquetes componen a un grupo usamos el siguiente modificador,

[root@scltest01 ~]# yum groupinfo "Performance Tools"
Setting up Group Process


Group: Performance Tools
 Description: Tools for diagnosing system and application-level performance problems.
 Mandatory Packages:
   blktrace
   sysstat
 Default Packages:
   dstat
   iotop
   latencytop
   oprofile
   perf
   powertop
   seekwatcher
 Optional Packages:
   oprofile-jit
   papi
   sdparm
   sg3_utils
   tuned
   tuned-utils


Si deseo eliminar un grupo de paquetes uso el modificador groupremove

[root@scltest01 ~]# yum groupremove "iSCSI Storage Client"
Setting up Group Process
Resolving Dependencies
--> Running transaction check
---> Package iscsi-initiator-utils.i686 0:6.2.0.872-21.el6 will be erased
--> Finished Dependency Resolution


Dependencies Resolved


================================================================================
 Package                     Arch       Version                 Repository
                                                                           Size
================================================================================
Removing:
 iscsi-initiator-utils       i686       6.2.0.872-21.el6        @sl       1.7 M


Transaction Summary
================================================================================
Remove        1 Package(s)


Installed size: 1.7 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : iscsi-initiator-utils-6.2.0.872-21.el6.i686                  1/1 


Removed:
  iscsi-initiator-utils.i686 0:6.2.0.872-21.el6                                 


Complete!

Podemos preguntarle al yum que paquete provee determinado archivo con el switch provides



[root@scltest01 ~]# yum provides /usr/bin/vim
2:vim-enhanced-7.2.411-1.6.el6.i686 : A version of the VIM editor which includes
                                    : recent enhancements
Repo        : sl
Matched from:
Filename    : /usr/bin/vim


2:vim-enhanced-7.2.411-1.6.el6.i686 : A version of the VIM editor which includes
                                    : recent enhancements
Repo        : installed
Matched from:
Other       : Provides-match: /usr/bin/vim



No hay comentarios:

Publicar un comentario