En entradas anteriores hemos hablado de la versión de apt-get ahora nos centramos en ofrecer un formato similar para YUM.
EL Yellowdog Updater Modified es una herramienta Open Source disponible para línea de comandos y a nivel de Interfaz Gráfica con Yum Extender basado en la paquetería RPM (RedHat Package Manager) para sistemas Linux. Permite a usuarios y administradores instalar, actualizar y buscar paquetes usando repositorios remotos/locales para instalarse en el Sistema. Fue creado por Seth Vidal bajo la licencia GPL (General Public License) para que pueda ser usado y modificado de manera gratuita.
¿Cómo instalar un Paquete?
Podremos instalar un paquete usando el comando yum install a diferencia de apt-get por defecto realizar un update y luego busca el paquete.
yum install firefox
Loaded plugins: fastestmirror Dependencies Resolved ================================================================================================ Package Arch Version Repository Size ================================================================================================ Updating: firefox i686 10.0.6-1.el6.centos updates 20 M Updating for dependencies: xulrunner i686 10.0.6-1.el6.centos updates 12 M Transaction Summary ================================================================================================ Install 0 Package(s) Upgrade 2 Package(s) Total download size: 32 M Is this ok [y/N]: y Downloading Packages: (1/2): firefox-10.0.6-1.el6.centos.i686.rpm | 20 MB 01:10 (2/2): xulrunner-10.0.6-1.el6.centos.i686.rpm | 12 MB 00:52 ------------------------------------------------------------------------------------------------ Total 63 kB/s | 32 MB 02:04 Updated: firefox.i686 0:10.0.6-1.el6.centos Dependency Updated: xulrunner.i686 0:10.0.6-1.el6.centos Complete!Nos pedirá confirmar la operación ofreciendo una lista con la versión a instalar y las dependencias necesarias podremos evitar la confirmación usando la opción –y
yum -y install Firefox
Remover un Paquete
Podremos remover un paquete y todas sus dependencias usando remove.
# yum remove firefox
Loaded plugins: fastestmirror Setting up Remove Process Resolving Dependencies --> Running transaction check ---> Package firefox.i686 0:10.0.6-1.el6.centos set to be erased --> Finished Dependency Resolution Dependencies Resolved ==================================================================================================== Package Arch Version Repository Size ==================================================================================================== Removing: firefox i686 10.0.6-1.el6.centos @updates 23 M Transaction Summary ==================================================================================================== Remove 1 Package(s) Reinstall 0 Package(s) Downgrade 0 Package(s) Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Erasing : firefox-10.0.6-1.el6.centos.i686 1/1 Removed: firefox.i686 0:10.0.6-1.el6.centos Complete!Podremos saltar la confirmación usando –y
yum -y remove Firefox
Actualizar un paquete único usando YUM.
En caso que tengamos por ejemplo una versión antigua de MySQL, podremos actualizar usando el comando update recuerda que también actualizara las dependencias.
# yum update mysql
Loaded plugins: fastestmirror Dependencies Resolved ============================================================================================================ Package Arch Version Repository Size ============================================================================================================ Updating: vsftpd i386 2.0.5-24.el5_8.1 updates 144 k Transaction Summary ============================================================================================================ Install 0 Package(s) Upgrade 1 Package(s) Total size: 144 k Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Updating : vsftpd 1/2 Cleanup : vsftpd 2/2 Updated: vsftpd.i386 0:2.0.5-24.el5_8.1 Complete!
Listar búsqueda de paquetes usando YUM.
Podremos listar nuestras búsquedas para un paquete o para un wildcard por ejemplo openssh o *ssh*
yum list openssh
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.neu.edu.cn * epel: mirror.neu.edu.cn * extras: mirror.neu.edu.cn * rpmforge: mirror.nl.leaseweb.net * updates: mirror.nus.edu.sg Installed Packages openssh.i386 4.3p2-72.el5_6.3 installed Available Packages 4.3p2-82.el5 base ¿Cómo buscar un Paquete? En caso de no recordar el nombre de un paquete podremos buscar parte de su nombre yum por defecto filtra por el nombre del paquete de no conseguirlo filtra por la descripción del paquete. yum search vsftpd Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.neu.edu.cn * epel: mirror.neu.edu.cn * extras: mirror.neu.edu.cn * rpmforge: mirror.nl.leaseweb.net * updates: ftp.iitm.ac.in ============================== Matched: vsftpd ======================== ccze.i386 : A robust log colorizer pure-ftpd-selinux.i386 : SELinux support for Pure-FTPD vsftpd.i386 : vsftpd - Very Secure Ftp Daemon
Obtener información de un paquete sin necesidad de Instalarlo
En algunos casos queremos saber la información de un paquete antes de instalarlo. Podremos usar info en ese caso.
yum info firefox
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.neu.edu.cn * epel: mirror.neu.edu.cn * extras: mirror.neu.edu.cn * rpmforge: mirror.nl.leaseweb.net * updates: ftp.iitm.ac.in Available Packages Name : firefox Arch : i386 Version : 10.0.6 Release : 1.el5.centos Size : 20 M Repo : updates Summary : Mozilla Firefox Web browser URL : http://www.mozilla.org/projects/firefox/ License : MPLv1.1 or GPLv2+ or LGPLv2+ Description: Mozilla Firefox is an open-source web browser, designed for standards : compliance, performance and portability.
Listar todos los paquetes disponibles usando YUM
Podremos listar todos los paquetes que tenemos disponibles en la base de datos de YUM al ser una lista muy larga usarla con un gestor de texto como less o more.
yum list | less
Yum Provides
La opción provides es realmente útil, si por ejemplo tienes un archivo de configuración y no sabes de quien provides puede identificar de que paquete es ese archivo haremos un ejemplo con httpd.conf y veremos cómo se asocia con Apache.
yum provides /etc/httpd/conf/httpd.conf
Loaded plugins: fastestmirror httpd-2.2.3-63.el5.centos.i386 : Apache HTTP Server Repo : base Matched from: Filename : /etc/httpd/conf/httpd.conf httpd-2.2.3-63.el5.centos.1.i386 : Apache HTTP Server Repo : updates Matched from: Filename : /etc/httpd/conf/httpd.conf httpd-2.2.3-65.el5.centos.i386 : Apache HTTP Server Repo : updates Matched from: Filename : /etc/httpd/conf/httpd.conf httpd-2.2.3-53.el5.centos.1.i386 : Apache HTTP Server Repo : installed Matched from: Other : Provides-match: /etc/httpd/conf/httpd.conf
Verificar actualizaciones con YUM
Podremos actualizar la lista de repo y adicional actualizar todos los paquetes usando update a diferencia de apt-get que necesita de update y upgrade.
yum update
En la paquetería RPM existen grupos de paquetes por ejemplo KDE son útiles cuando queremos instalar una gran cantidad de paquetes, podremos listarlos con grouplist
yum grouplist
Installed Groups: Administration Tools DNS Name Server Dialup Networking Support Editors Engineering and Scientific FTP Server Graphics Java Development Legacy Network Server Available Groups: Authoring and Publishing Base Beagle Cluster Storage Clustering Development Libraries Development Tools Eclipse Educational Software KDE (K Desktop Environment) KDE Software Development
Instalar un Grupo de Paquetes
Como había comentado podremos listar o instalar grupo de paquetes haremos el ejemplo con MySQL.
yum groupinstall 'MySQL Database'
Dependencies Resolved ================================================================================================= Package Arch Version Repository Size ================================================================================================= Updating: unixODBC i386 2.2.11-10.el5 base 290 k Installing for dependencies: unixODBC-libs i386 2.2.11-10.el5 base 551 k Transaction Summary ================================================================================================= Install 1 Package(s) Upgrade 1 Package(s) Total size: 841 k Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : unixODBC-libs 1/3 Updating : unixODBC 2/3 Cleanup : unixODBC 3/3 Dependency Installed: unixODBC-libs.i386 0:2.2.11-10.el5 Updated: unixODBC.i386 0:2.2.11-10.el5 Complete!
Actualizar un Grupo de Paquete
Podremos actualizar un Grupo de paquetes en específico usando groupupdate .
yum groupupdate 'DNS Name Server'
Dependencies Resolved ================================================================================================================ Package Arch Version Repository Size ================================================================================================================ Updating: bind i386 30:9.3.6-20.P1.el5_8.2 updates 981 k bind-chroot i386 30:9.3.6-20.P1.el5_8.2 updates 47 k Updating for dependencies: bind-libs i386 30:9.3.6-20.P1.el5_8.2 updates 864 k bind-utils i386 30:9.3.6-20.P1.el5_8.2 updates 174 k Transaction Summary ================================================================================================================ Install 0 Package(s) Upgrade 4 Package(s) Total size: 2.0 M Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Updating : bind-libs 1/8 Updating : bind 2/8 Updating : bind-chroot 3/8 Updating : bind-utils 4/8 Cleanup : bind 5/8 Cleanup : bind-chroot 6/8 Cleanup : bind-utils 7/8 Cleanup : bind-libs 8/8 Updated: bind.i386 30:9.3.6-20.P1.el5_8.2 bind-chroot.i386 30:9.3.6-20.P1.el5_8.2 Dependency Updated: bind-libs.i386 30:9.3.6-20.P1.el5_8.2 bind-utils.i386 30:9.3.6-20.P1.el5_8.2 Complete!Tambien podremos Eliminar un grupo usando groupremove
yum groupremove 'DNS Name Server'
Dependencies Resolved =========================================================================================================== Package Arch Version Repository Size =========================================================================================================== Removing: bind i386 30:9.3.6-20.P1.el5_8.2 installed 2.1 M bind-chroot i386 30:9.3.6-20.P1.el5_8.2 installed 0.0 Transaction Summary =========================================================================================================== Remove 2 Package(s) Reinstall 0 Package(s) Downgrade 0 Package(s) Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Erasing : bind 1/2 warning: /etc/sysconfig/named saved as /etc/sysconfig/named.rpmsave Erasing : bind-chroot 2/2 Removed: bind.i386 30:9.3.6-20.P1.el5_8.2 bind-chroot.i386 30:9.3.6-20.P1.el5_8.2 Complete!
Listar Repositorios Habilitados con YUM.
Podremos visualizar todos los repositorios con repolist
yum repolist
repo id repo name status base CentOS-5 - Base enabled: 2,725 epel Extra Packages for Enterprise Linux 5 - i386 enabled: 5,783 extras CentOS-5 - Extras enabled: 282 mod-pagespeed mod-pagespeed enabled: 1 rpmforge RHEL 5 - RPMforge.net - dag enabled: 11,290 updates CentOS-5 - Updates enabled: 743 repolist: 20,824
Listar todos los Repositorios.
En caso de listar los repos habilitados o deshabilitados usamos la opción all
yum repolist all
repo id repo name status C5.0-base CentOS-5.0 - Base disabled C5.0-centosplus CentOS-5.0 - Plus disabled C5.0-extras CentOS-5.0 - Extras disabled base CentOS-5 - Base enabled: 2,725 epel Extra Packages for Enterprise Linux 5 - i386 enabled: 5,783 extras CentOS-5 - Extras enabled: 282 repolist: 20,824
Instalar un paquete de un repositorio específico
En ocasiones necesitamos de una versión modificada de un paquete que solo se encuentra en un repo, otro caso puede ser para elegir un repo local y evitar tráfico de red innecesario.
yum --enablerepo=epel install phpmyadmin
Dependencies Resolved ============================================================================================= Package Arch Version Repository Size ============================================================================================= Installing: phpMyAdmin noarch 3.5.1-1.el6 epel 4.2 M Transaction Summary ============================================================================================= Install 1 Package(s) Total download size: 4.2 M Installed size: 17 M Is this ok [y/N]: y Downloading Packages: phpMyAdmin-3.5.1-1.el6.noarch.rpm | 4.2 MB 00:25 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : phpMyAdmin-3.5.1-1.el6.noarch 1/1 Verifying : phpMyAdmin-3.5.1-1.el6.noarch 1/1 Installed: phpMyAdmin.noarch 0:3.5.1-1.el6 Complete!
Utilizando Yum Shell
Podremos usar una Shell si queremos hacer muchos cambios en los paquetes, se usan los mismos comandos pero no es necesario colocar yum al comienzo.
yum shell
Loaded plugins: fastestmirror Setting up Yum Shell > update httpd Loading mirror speeds from cached hostfile * base: mirrors.sin3.sg.voxel.net * epel: ftp.riken.jp * extras: mirrors.sin3.sg.voxel.net * updates: mirrors.sin3.sg.voxel.net Setting up Update Process >-