Monday, 19 November 2012

Centos 6/RHEL using Repoquery and Yum commands

You can use the repoquery command to list packages, it will work with installed packages as well packages not yet installed.

Install yum-utils            

$ sudo yum -y install yum-utils

Example syntax below

$ repoquery -q -l <package_name>
$ repoquery -q -l --plugins <package_name>
$ repoquery -i <package_name>

For example

$ repoquery -q -l mysql-libs


Or for more information

$ repoquery -i mysql-libs

Name        : mysql-libs
Version     : 5.1.69
Release     : 1.el6_4
Architecture: i686
Size        : 4126608
Packager    : CentOS BuildSystem <>
Group       : Applications/Databases
URL         :
Repository  : updates
Summary     : The shared libraries required for MySQL clients
Source      : mysql-5.1.69-1.el6_4.src.rpm
Description :
The mysql-libs package provides the essential shared libraries for any
MySQL client program or interface. You will need to install this package
to use any other MySQL package or any clients that need to connect to a
MySQL server.

Use it in conjunction with the yum list updates command 

$ yum list updates
$ yum list updates openssh
$ sudo yum -y update openssh 

Shows output (among other)

[root@Centos anton]# Running Transaction Test
  Updating   : openssh-server-5.3p1-81.el6_3.i686                        2/6 
  Updating   : openssh-clients-5.3p1-81.el6_3.i686                          3/6 
  Cleanup    : openssh-clients-5.3p1-81.el6.i686                            4/6 
  Cleanup    : openssh-server-5.3p1-81.el6.i686                             5/6 
  Cleanup    : openssh-5.3p1-81.el6.i686                                    6/6 
  Verifying  : openssh-server-5.3p1-81.el6_3.i686                           1/6 
  Verifying  : openssh-5.3p1-81.el6_3.i686                                  2/6 
  Verifying  : openssh-clients-5.3p1-81.el6_3.i686                          3/6 
  Verifying  : openssh-clients-5.3p1-81.el6.i686                            4/6 
  Verifying  : openssh-5.3p1-81.el6.i686                                    5/6 
  Verifying  : openssh-server-5.3p1-81.el6.i686                             6/6 

  openssh.i686 0:5.3p1-81.el6_3                                                 
Dependency Updated:
  openssh-clients.i686 0:5.3p1-81.el6_3   openssh-server.i686 0:5.3p1-81.el6_3  

[root@Centos anton]# 

Exclude Packages

You can permanently exclude packages you do not wish to be updated with yum update, just add an entry into yum.conf

$ sudo vi /etc/yum.conf

and append the following in the 'main' section

exclude=kernel*php*        to exclude kernel and php packages

Disable the exclude if necessary by using

$ sudo yum -y --disableexcludes=main install php

$ sudo yum -y --disableexcludes=all update

$ sudo yum -y --disableexcludes=repoid install php

Other commands

$ yum info <package_name> $ yum repolist
$ yum list available
$ yum list available | grep gimp

Shows output             

gimp-data-extras.noarch                  2.0.2-3.1.el6                   base   
gimp-devel.i686                          2:2.6.9-4.el6_3.3               updates
gimp-devel-tools.i686                    2:2.6.9-4.el6_3.3               updates
gimp-help.noarch                         2.4.2-5.1.el6                   base   
gimp-help-browser.i686                   2:2.6.9-4.el6_3.3               updates
gimpfx-foundry.noarch                    2.6.1-3.el6                     epel   

More repoquery commands

More repos