Tienda Wifi

Tienda Wifi
CiudadWireless es la tienda Wifi recomendada por elhacker.NET

Entradas Mensuales

Síguenos en:

Canal Oficial Telegram de elhacker.NET Grupo Facebook elhacker.NET Twitter elhacker.NET Canal Youtube elhacker.NET Comunidad Steam: Grupo elhacker.NET Mastodon

Entradas populares

PostHeaderIcon Gestión de paquetes en Linux con Yum


Yellowdog Updater Modified (YUM) es el gestor de paquetes que nos facilita de manera asombrosa la instalación, actualización y manteniemiento de paquetes en sistemas basados en Red Hat  tales como CentOS y Fedora





yum es un paquete administrador de software(software package manager), esta escrito en Python y es una herramienta muy util para instalar, actualizar y remover paquetes junto con sus dependencias en distribuciones Linux basados en RPM (redhat, fedora, centos, etc.). Automáticamente determina las dependencias necesarias y lo que debe realizarse para instalar paquetes.
  • /etc/yum.conf - archivo de configuración.
  • /etc/yum.repos.d - directorio de depósitos o repositorios. 
  • /var/log/yum.log - archivo log

 


Comandos básicos

sin pedir confirmacion, Instalar, re-instala, desinstalar, elimina, busca, actualiza, repositorios
$ yum -y | install | reinstall | remove | erase | search | update | repolist |

Plugins de yum

/etc/yum.conf añadir
plugins=1

yum
yum-aliases
yum-allowdowngrade
yum-arch
yum-basearchonly
yum-changelog
yum-cron
yum-downloadonly
yumex.noarch
yum-fastestmirror
yum-filter-data
yumi.noarch
yum-kernel-module
yum-kmod
yum-list-data
yum-merge-conf
yum-metadata-parser
yum-priorities
yum-protectbase
yum-protect-packages
yum-refresh-updatesd
yum-security
yum-skip-broken
yum-tsflags
yum-updateonboot
yum-updatesd
yum-upgrade-helper
yum-utils
yum-versionlock

Clonar o copiar la instalación de paquetes de una máquina a otra (Migración)

Listado de paquetes instalados (guarda en el fichero installed_packages.txt) el nombre de los paquetes  instalados:
# yum list installed |tail -n +3|cut -d' ' -f1 > installed_packages.txt
 
usando rpm
 
$ rpm -qa  > /backup/installed-software.log 
 
Para instalar en la otra instalación:
 
# yum -y install $(cat installed_packages.txt)

 Comparar dos instalaciones

rpm -qa --queryformat='%{NAME}\n' | sort > server.txt

diff serverold.txt servernew.txt

Añadir o quitar repositorio


$ yum --enablerepo=epel install rsnapshot
$ yum --disablerepo=epel install package-name

 Exlcuir paquete a instalar


$ yum --exclude=package kernel* update

Listado dependencias paquetes


 # yum deplist mysql

Finding dependencies:
package: mysql.x86_64 5.1.71-1.el6
  dependency: libssl.so.10()(64bit)
   provider: openssl.x86_64 1.0.1e-15.el6
   provider: openssl.x86_64 1.0.1e-16.el6_5
  dependency: libstdc++.so.6()(64bit)
   provider: libstdc++.x86_64 4.4.7-4.el6
[..]

# yum whatprovides /etc/yum.conf

Searching Packages:
Setting up repositories
updates-released          100% |=========================|  951 B    00:00
extras                    100% |=========================| 1.1 kB    00:00
base                      100% |=========================| 1.1 kB    00:00
Reading repository metadata in from local files
primary.xml.gz            100% |=========================| 977 kB    00:01
extras    : ################################################## 2714/2714
Added 8 new packages, deleted 0 old in 6.65 seconds

yum.noarch                               2.3.2-7                base
Matched from:
/etc/yum.conf

[..]

# yum provides /usr/bin/ssh
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.jgotteswinter.com
 * extras: mirror.jgotteswinter.com
 * updates: mirror.jgotteswinter.com
openssh-clients-5.3p1-94.el6.x86_64 : An open source SSH client applications
Repo        : base
Matched from:
Filename    : /usr/bin/ssh

openssh-clients-5.3p1-94.el6.x86_64 : An open source SSH client applications
Repo        : installed
Matched from:
Other       : Provides-match: /usr/bin/ssh





Listar sólo el nombre de los paquetes:

$ yum deplist $(rpm -q gcl) | awk '/provider:/ { print $2 }'|sort|uniq
bash.x86_64
gcl-selinux.x86_64
glibc.i686
glibc.x86_64
gmp.x86_64
info.x86_64
libX11.x86_64
readline.x86_64
tcl.x86_64
tk.x86_64
zlib.x86_64

Instalar grupos de paquetes

 # yum grouplist
Setting up Group Process
Installed Groups:
   Additional Development
   Compatibility libraries
   Development tools
   Directory Client
   E-mail server
   Fonts
   Graphical Administration Tools
   Hardware monitoring utilities
   Large Systems Performance
   Legacy UNIX compatibility
   Network Infrastructure Server
   Networking Tools
   Performance Tools
   Perl Support
   SNMP Support
   Scalable Filesystems
   Scientific support
   Security Tools
   System administration tools
Installed Language Groups:
   Arabic Support [ar]
   Armenian Support [hy]
   Georgian Support [ka]
   Hebrew Support [he]
   Inuktitut Support [iu]
   Lao Support [lo]
   Tajik Support [tg]
Available Groups:
   Backup Client
   Backup Server
   Base
   CIFS file server
   Client management tools
   Console internet tools
   Debugging Tools
   Desktop
   Desktop Debugging and Performance Tools
   Desktop Platform
   Desktop Platform Development
   Dial-up Networking Support
   Directory Server
   Eclipse
   Emacs
   FCoE Storage Client
   FTP server
   General Purpose Desktop
   Graphics Creation Tools
   High Availability
   High Availability Management
   Identity Management Server
   Infiniband Support
   Input Methods
   Internet Applications
   Internet Browser
   Java Platform
   KDE Desktop
   Legacy X Window System compatibility
   Load Balancer
   Mainframe Access
   Messaging Client Support
   MySQL Database client
   MySQL Database server
   NFS file server
   Network Storage Server
   Network file system client
   Office Suite and Productivity
   PHP Support
   PostgreSQL Database client
   PostgreSQL Database server
   Print Server
   Printing client
   Remote Desktop Clients
   Resilient Storage
   Ruby Support
   Server Platform
   Server Platform Development
   Smart card support
   Storage Availability Tools
   System Management
   TeX support
   Technical Writing
   TurboGears application framework
   Virtualization
   Virtualization Client
   Virtualization Platform
   Virtualization Tools
   Web Server
   Web Servlet Engine
   Web-Based Enterprise Management
   X Window System
   iSCSI Storage Client
Instalar paquete

# yum groupinstall 'Development Tools'

 Buscar paquetes

# yum search perl
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
============================== N/S Matched: perl ===============================
ImageMagick-perl.x86_64 : ImageMagick perl bindings
OpenIPMI-perl.x86_64 : IPMI Perl language bindings
evolution-perl.x86_64 : Supplemental utilities that require Perl
freeradius-perl.x86_64 : Perl support for freeradius
graphviz-perl.x86_64 : Perl extension for graphviz
groff-perl.x86_64 : Parts of the groff formatting system that require Perl
libpurple-perl.x86_64 : Perl scripting support for libpurple
mod_perl.x86_64 : An embedded Perl interpreter for the Apache HTTP Server
mod_perl-devel.i686 : Files needed for building XS modules that use mod_perl
mod_perl-devel.x86_64 : Files needed for building XS modules that use mod_perl
net-snmp-perl.x86_64 : The perl NET-SNMP module and the mib2c tool
ntp-perl.x86_64 : NTP utilities written in perl
openssl-perl.x86_64 : Perl scripts provided with OpenSSL
openwsman-perl.x86_64 : Perl bindings for openwsman client API
perl-Algorithm-Diff.noarch : Algorithm::Diff Perl module
perl-AppConfig.noarch : Perl module for reading configuration files
perl-Archive-Tar.x86_64 : A module for Perl manipulation of .tar files
[..]

Rollback de instalaciones y actualizaciones con yum history

Historial de paquetes instalados con yum


# yum history
Loaded plugins: fastestmirror
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
   116 | root               | 2013-12-04 12:33 | Install        |    8
   115 | root               | 2013-12-04 11:36 | Update         |    2
   114 | root               | 2013-12-02 10:25 | I, U           |  179 EE
   113 | root               | 2013-12-01 18:00 | Install        |    2 EE
   112 | root               | 2013-12-01 17:48 | Install        |  111
   111 | root               | 2013-12-01 13:57 | Install        |    1
   110 | root               | 2013-12-01 13:44 | Install        |    4
   109 | root               | 2013-12-01 13:44 | Install        |    2  <
   108 | root               | 2013-11-27 10:28 | Install        |    4 ><
   107 | root               | 2013-11-27 10:03 | Install        |    5 >
   106 | root               | 2013-11-27 10:01 | Install        |   25 EE
   105 | root               | 2013-11-27 09:55 | Install        |   28
   104 | root               | 2013-11-27 09:41 | Install        |    1
   103 | root               | 2013-11-27 09:38 | Install        |    3
   102 | root               | 2013-11-27 09:33 | Install        |   46  <
   101 | root               | 2013-11-26 23:51 | Install        |    2 >
   100 | root               | 2013-11-26 20:13 | Install        |    1
    99 | root               | 2013-11-26 20:08 | Install        |    2
    98 | root               | 2013-11-26 20:00 | Install        |    1
    97 | root               | 2013-11-26 20:00 | Install        |    1

 

 

# yum history info 115
Loaded plugins: fastestmirror
Transaction ID : 115
Begin time     : Wed Dec  4 11:36:56 2013
Begin rpmdb    : 618:c20ec91ec679fe2c66266fd87301290e99ea088b
End time       :                          (0 seconds)
End rpmdb      : 618:a4d0b78bb6d1a3d1a9db7b4eced5b21d2a4b7697
User           : root 
Return-Code    : Success
Command Line   : -y update
Transaction performed with:
    Installed     rpm-4.8.0-37.el6.x86_64                       @base
    Installed     yum-3.2.29-40.el6.centos.noarch               @base
    Installed     yum-plugin-fastestmirror-1.1.30-14.el6.noarch @base
Packages Altered:
    Updated openssl-1.0.1e-15.el6.x86_64         @base
    Update          1.0.1e-16.el6_5.x86_64       @updates
    Updated openssl-devel-1.0.1e-15.el6.x86_64   @base
    Update                1.0.1e-16.el6_5.x86_64 @updates
history info

Desinstalar paquetes instalados con yum en una transacción determinada


# yum history undo 14
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
...
...

Undoing transaction 14, from Sat Nov 17 11:25:40 2012  Install 
 crypto-utils-2.4.1-24.2.el6.i686 @base
    Dep-Install perl-Newt-1.08-26.el6.i686       @base
Resolving Dependencies
--> Running transaction check
---> Package crypto-utils.i686 0:2.4.1-24.2.el6 will be erased
---> Package perl-Newt.i686 0:1.08-26.el6 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
 Package             Arch         Version          Repository          Size
=============================================================================
Removing:
 crypto-utils         i686        2.4.1-24.2.el6       @base          169 k
 perl-Newt            i686        1.08-26.el6          @base          205 k

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

Installed size: 373 k
Is this ok [y/N]:

 

Rehacer una transacción

# yum history redo 14
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: ftp.udc.es
 * extras: ftp.udc.es
 * updates: ftp.udc.es
Repeating transaction 14, from Sat Nov 17 11:25:40 2012
    Install     crypto-utils-2.4.1-24.2.el6.i686 @base
    Dep-Install perl-Newt-1.08-26.el6.i686       @base
Resolving Dependencies
--> Running transaction check
---> Package crypto-utils.i686 0:2.4.1-24.2.el6 will be installed
--> Processing Dependency: perl(Newt) for package: crypto-utils-2.4.1-24.2.el6.i686
--> Running transaction check
---> Package perl-Newt.i686 0:1.08-26.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================
 Package                         Arch    Version           Repository   Size
==============================================================================
Installing:
 crypto-utils                     i686   2.4.1-24.2.el6     base         75 k
Installing for dependencies:
 perl-Newt                        i686   1.08-26.el6        base         72 k

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

Total download size: 147 k
Installed size: 373 k
Is this ok [y/N]:

 

En qué paquete se encuentra un determinado fichero

# yum whatprovides libssl3.so
46 packages excluded due to repository priority protections

Other       : libssl3.so

nss-3.12.8-4.el5_6.i386 : Network Security Services
Repo        : updates
Matched from:
Other       : libssl3.so

Instalar únicamente actualizaciones de seguridad

# yum install yum-security
# yum list-security
# yum update --security 

Hacer downgrade de un paquete instalado

# yum install yum-allowdowngrade
# yum --allow-downgrade install mysql
# yum --allow-downgrade info mysql

Ver las dependencias de un paquete

# yum deplist httpd

package: httpd.i386 2.2.3-45.el5.centos.1
dependency: libz.so.1
provider: zlib.i386 1.2.3-3
dependency: /bin/mv
provider: coreutils.i386 5.97-23.el5_4.2
provider: coreutils.i386 5.97-23.el5_6.4
provider: coreutils.i386 5.97-23.el5_6.3
dependency: liblber-2.3.so.0
provider: openldap.i386 2.3.43-12.el5_5.3
provider: openldap.i386 2.3.43-12.el5_6.7
provider: openldap.i386 2.3.43-12.el5_6.5


Instalar un RPM y que yum instale las dependencias

# yum localinstall /home/el-brujo/paquete.rpm

Actualizar un paquete instalado por yum mediante un RPM

# yum localupdate /home/el-brujo/paquete.rpm


yum no tiene ninguna opción  de instalar paquetes sin mirar las dependencias o instalación forzada, al contrario que  rpm que si ofrece las opciones --nodep y --force  para instalar un paquete

El motivo es que yum no ofrece esta opciones es que precisamente ha sido diseñado para solventar las depedencias y se niega a instalar paquetes con problemas o que puedan provocar conflictos. En yum puedes usar las opciones reinstall, downgrade, package-cleanup y history undo/redo

0 comentarios :

Publicar un comentario

Los comentarios pueden ser revisados en cualquier momento por los moderadores.

Serán publicados aquellos que cumplan las siguientes condiciones:
- Comentario acorde al contenido del post.
- Prohibido mensajes de tipo SPAM.
- Evite incluir links innecesarios en su comentario.
- Contenidos ofensivos, amenazas e insultos no serán permitidos.

Debe saber que los comentarios de los lectores no reflejan necesariamente la opinión del STAFF.