SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


Sidebar

Recently Changed Pages:

View All Pages


View All Tags


LinkedIn




WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.


Pages with comments

View All Comments

redhatsoftware

Red Hat Software

Over the last years Red Hat always had a problem with their software management. Debian had apt, Suse settled on yum but Red Hat tried several software management tools. For now they seem to have settled on yum as well. So this page is about Red Hats implementation of yum. Yum stands for Yellowdog Updater, Modified and works with repositories to manage RPMs which is the format most software on Linux systems is packed in. In this page you'll also find some references to the original rpm command the yum commands are based on.

YUM Basic Usage

YUM List

yum list
yum list installed
yum list available
  • yum list: displays both installed as well as available packages
  • yum list installed: displays installed packages only
  • yum list available: displays available packages only

You can recognize by the output whether a package is installed or avaiable:

INSTALLED:

zip.x86_64                  3.0-1.el6        @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
zlib.x86_64                 1.2.3-29.el6     @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5

AVAILABLE:
MySQL-python.x86_64                                   1.2.3-0.3.c1.1.el6          rhel-6-server-rpms

As you can see installed packages are listed as coming from @anaconda while the available packages list with a repository name.

yum search <keyword>

Yum search will provide you with all packages that have that specific keyword in it's description or name:

[root@localhost ~]# yum search zip
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is receiving updates from Red Hat Subscription Management.
rhel-6-server-cf-tools-1-rpms                                                                                       | 2.8 kB     00:00
rhel-6-server-rpms                                                                                                  | 3.7 kB     00:00
============================================================ N/S Matched: zip =============================================================
bzip2-devel.i686 : Header files developing apps which will use bzip2
bzip2-devel.x86_64 : Header files developing apps which will use bzip2
bzip2-libs.i686 : Libraries for applications using bzip2
bzip2-libs.x86_64 : Libraries for applications using bzip2
perl-Compress-Raw-Bzip2.x86_64 : Low-Level Interface to bzip2 compression library
perl-IO-Compress-Bzip2.x86_64 : Perl interface to allow reading and writing of bzip2 data
unzip.x86_64 : A utility for unpacking zip files
zip.x86_64 : A file compression and packaging utility compatible with PKZIP
bzip2.x86_64 : A file compression utility
gzip.x86_64 : The GNU data compression program
perl-IO-Compress-Zlib.x86_64 : Perl interface to allow reading and writing of gzip and zip data

  Name and summary matches only, use "search all" for everything.

YUM Info

yum info <packagename>

Yum info provides detailed information about a specific package:

[root@localhost ~]# yum info zip
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is receiving updates from Red Hat Subscription Management.
rhel-6-server-cf-tools-1-rpms                                                                                       | 2.8 kB     00:00
rhel-6-server-rpms                                                                                                  | 3.7 kB     00:00
Installed Packages
Name        : zip
Arch        : x86_64
Version     : 3.0
Release     : 1.el6
Size        : 804 k
Repo        : installed
From repo   : anaconda-RedHatEnterpriseLinux-201311111358.x86_64
Summary     : A file compression and packaging utility compatible with PKZIP
URL         : http://www.info-zip.org/Zip.html
License     : BSD
Description : The zip program is a compression and file packaging utility.  Zip is
            : analogous to a combination of the UNIX tar and compress commands and
            : is compatible with PKZIP (a compression and file packaging utility for
            : MS-DOS systems).
            :
            : Install the zip package if you need to compress files using the zip
            : program.

YUM Provides

yum provides <pathname>

Yum provides gives you the option to search which packages provides a specific command or file.

Note that if you don't know the exact path you could do: yum provides '*/command', for example yum provides '*/xclock'
[root@localhost ~]# which system-config-kickstart
/usr/bin/system-config-kickstart
[root@localhost ~]# yum provides /usr/bin/system-config-kickstart
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is receiving updates from Red Hat Subscription Management.
rhel-6-server-cf-tools-1-rpms                                                                                       | 2.8 kB     00:00
rhel-6-server-rpms                                                                                                  | 3.7 kB     00:00
system-config-kickstart-2.8.6.5-1.el6.noarch : A graphical interface for making kickstart files
Repo        : rhel-6-server-rpms
Matched from:
Filename    : /usr/bin/system-config-kickstart

system-config-kickstart-2.8.6.2-1.el6.noarch : A graphical interface for making kickstart files
Repo        : rhel-6-server-rpms
Matched from:
Filename    : /usr/bin/system-config-kickstart

system-config-kickstart-2.8.6.4-1.el6.noarch : A graphical interface for making kickstart files
Repo        : rhel-6-server-rpms
Matched from:
Filename    : /usr/bin/system-config-kickstart

system-config-kickstart-2.8.6.3-1.el6.noarch : A graphical interface for making kickstart files
Repo        : rhel-6-server-rpms
Matched from:
Filename    : /usr/bin/system-config-kickstart

system-config-kickstart-2.8.6.5-1.el6.noarch : A graphical interface for making kickstart files
Repo        : installed
Matched from:
Other       : Provides-match: /usr/bin/system-config-kickstart

YUM Install

yum install <packagename>

Yum install lets you install a package, including any dependency.

[root@localhost ~]# yum install yum-plugin-versionlock
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is receiving updates from Red Hat Subscription Management.
rhel-6-server-cf-tools-1-rpms                                                                                       | 2.8 kB     00:00
rhel-6-server-rpms                                                                                                  | 3.7 kB     00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package yum-plugin-versionlock.noarch 0:1.1.30-17.el6_5 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================
 Package                                Arch                   Version                            Repository                          Size
===========================================================================================================================================
Installing:
 yum-plugin-versionlock                 noarch                 1.1.30-17.el6_5                    rhel-6-server-rpms                  28 k

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

Total download size: 28 k
Installed size: 43 k
Is this ok [y/N]: y
Downloading Packages:
yum-plugin-versionlock-1.1.30-17.el6_5.noarch.rpm                                                                   |  28 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : yum-plugin-versionlock-1.1.30-17.el6_5.noarch                                                                           1/1
rhel-6-server-rpms/productid                                                                                        | 1.7 kB     00:00
  Verifying  : yum-plugin-versionlock-1.1.30-17.el6_5.noarch                                                                           1/1

Installed:
  yum-plugin-versionlock.noarch 0:1.1.30-17.el6_5

Complete!

YUM Remove

yum remove <package>

Yum remove is to remove a package that is installed by yum as well. It will also remove software that is dependent on the package, but it will not remove the packages the package you're removing is dependent upon.

[root@localhost ~]# yum remove zip
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager, versionlock
This system is receiving updates from Red Hat Subscription Management.
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package zip.x86_64 0:3.0-1.el6 will be erased
--> Finished Dependency Resolution
rhel-6-server-cf-tools-1-rpms                                                                                       | 2.8 kB     00:00
rhel-6-server-rpms                                                                                                  | 3.7 kB     00:00

Dependencies Resolved

===========================================================================================================================================
 Package          Arch                Version                   Repository                                                            Size
===========================================================================================================================================
Removing:
 zip              x86_64              3.0-1.el6                 @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5              804 k

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

Installed size: 804 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : zip-3.0-1.el6.x86_64                                                                                                    1/1
  Verifying  : zip-3.0-1.el6.x86_64                                                                                                    1/1

Removed:
  zip.x86_64 0:3.0-1.el6

Complete!
Note that yum remove will also remove the packages that require the package you're removing. This could lead to a little unexpected behavior so check the list of the packages that are being removed.

YUM Update

yum update
yum update <package>
  • yum update: this installs all updates for all packages
  • yum update <package>: updates only the package you listed
[root@localhost ~]# yum update yum
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager, versionlock
This system is receiving updates from Red Hat Subscription Management.
rhel-6-server-cf-tools-1-rpms                                                                                       | 2.8 kB     00:00
rhel-6-server-rpms                                                                                                  | 3.7 kB     00:00
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package yum.noarch 0:3.2.29-40.el6 will be updated
---> Package yum.noarch 0:3.2.29-43.el6_5 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================
 Package                  Arch                        Version                                Repository                               Size
===========================================================================================================================================
Updating:
 yum                      noarch                      3.2.29-43.el6_5                        rhel-6-server-rpms                      996 k

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

Total download size: 996 k
Is this ok [y/N]: y
Downloading Packages:
yum-3.2.29-43.el6_5.noarch.rpm                                                                                      | 996 kB     00:02
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : yum-3.2.29-43.el6_5.noarch                                                                                              1/2
  Cleanup    : yum-3.2.29-40.el6.noarch                                                                                                2/2
  Verifying  : yum-3.2.29-43.el6_5.noarch                                                                                              1/2
  Verifying  : yum-3.2.29-40.el6.noarch                                                                                                2/2

Updated:
  yum.noarch 0:3.2.29-43.el6_5

Complete!

YUM History

yum history
yum history info #

Yum history provides a list of what has been done with yum and allows you to request more info about a specific event:

[root@localhost ~]# yum history
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager, versionlock
This system is receiving updates from Red Hat Subscription Management.
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     5 | root <root>              | 2014-04-06 06:12 | Update         |    1
     4 | root <root>              | 2014-04-06 05:50 | Erase          |    1
     3 | root <root>              | 2014-04-06 05:48 | Install        |    1
     2 | redhatbox <sjoerdhooft>  | 2014-03-17 12:42 | I, U           |   28
     1 | System <unset>           | 2014-03-17 02:25 | Install        |  938
history list
[root@localhost ~]# yum history info 5
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager, versionlock
This system is receiving updates from Red Hat Subscription Management.
Transaction ID : 5
Begin time     : Sun Apr  6 06:12:58 2014
Begin rpmdb    : 965:d8a30c460d6c45ae9c80c158c73a2ab212c42d4c
End time       :            06:13:02 2014 (4 seconds)
End rpmdb      : 965:e3cde6d9604a82f8d426afb0004810798e5d05cf
User           : root <root>
Return-Code    : Success
Command Line   : update yum
Transaction performed with:
    Installed     rpm-4.8.0-37.el6.x86_64                  @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
    Installed     subscription-manager-1.9.11-1.el6.x86_64 @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
    Updated       yum-3.2.29-40.el6.noarch                 @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
Packages Altered:
    Updated yum-3.2.29-40.el6.noarch   @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
    Update      3.2.29-43.el6_5.noarch @rhel-6-server-rpms
history info
[root@localhost ~]#

Software Management Graphically

There is also an option to manage the software through a graphical tool. Go to System → Administration → Add/Remove Software. This will start this tool which will also allow you to do some basic tasks:

redhatsoftware01.jpg

You can just select the package you want to install and click apply. After that it will show as installed:

redhatsoftware02.jpg

YUM Plugins

Yum also allows for plugins to be added so more functionality comes available. There are quite some plugins available:

[root@localhost ~]# yum list  | grep yum-plugin
This system is receiving updates from Red Hat Subscription Management.
PackageKit-yum-plugin.x86_64      0.5.8-21.el6                @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
anaconda-yum-plugins.noarch       1:1.0-5.1.el6               @rhel-6-server-rpms
yum-plugin-security.noarch        1.1.30-14.el6               @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
yum-plugin-versionlock.noarch     1.1.30-17.el6_5             @rhel-6-server-rpms
kabi-yum-plugins.noarch           1.0-2.el6                   rhel-6-server-rpms
yum-plugin-aliases.noarch         1.1.30-17.el6_5             rhel-6-server-rpms
yum-plugin-changelog.noarch       1.1.30-17.el6_5             rhel-6-server-rpms
yum-plugin-downloadonly.noarch    1.1.30-17.el6_5             rhel-6-server-rpms
yum-plugin-protect-packages.noarch
yum-plugin-security.noarch        1.1.30-17.el6_5             rhel-6-server-rpms
yum-plugin-tmprepo.noarch         1.1.30-17.el6_5             rhel-6-server-rpms
yum-plugin-verify.noarch          1.1.30-17.el6_5             rhel-6-server-rpms

The plugin I installed in a previous section, yum-plugin-versionlock allows you to prevent a package from upgrading:

yum versionlock add <package>
yum versionlock lock

This shows you how to lock

THERE IS A UPDATE FOR PYTHON:

[root@localhost ~]# yum update python
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager, versionlock
This system is receiving updates from Red Hat Subscription Management.
rhel-6-server-cf-tools-1-rpms                                                                                       | 2.8 kB     00:00
rhel-6-server-rpms                                                                                                  | 3.7 kB     00:00
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package python.x86_64 0:2.6.6-51.el6 will be updated
---> Package python.x86_64 0:2.6.6-52.el6 will be an update
--> Processing Dependency: python-libs(x86-64) = 2.6.6-52.el6 for package: python-2.6.6-52.el6.x86_64
--> Running transaction check
---> Package python-libs.x86_64 0:2.6.6-51.el6 will be updated
---> Package python-libs.x86_64 0:2.6.6-52.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================
 Package                         Arch                       Version                           Repository                              Size
===========================================================================================================================================
Updating:
 python                          x86_64                     2.6.6-52.el6                      rhel-6-server-rpms                      74 k
Updating for dependencies:
 python-libs                     x86_64                     2.6.6-52.el6                      rhel-6-server-rpms                     5.3 M

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

Total download size: 5.4 M
Is this ok [y/N]: n
Exiting on user Command

ADD PYTHON TO THE VERSIONLOCK LIST

[root@localhost ~]# yum versionlock add python
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager, versionlock
This system is receiving updates from Red Hat Subscription Management.
Adding versionlock on: 0:python-2.6.6-51.el6
versionlock added: 1
[root@localhost ~]# yum versionlock list
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager, versionlock
This system is receiving updates from Red Hat Subscription Management.
0:python-2.6.6-51.el6.*
versionlock list done

TRY TO UPDATE PYTHON:

[root@localhost ~]# yum update python
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager, versionlock
This system is receiving updates from Red Hat Subscription Management.
rhel-6-server-cf-tools-1-rpms                                                                                       | 2.8 kB     00:00
rhel-6-server-rpms                                                                                                  | 3.7 kB     00:00
Setting up Update Process
No Packages marked for Update

As you can see, there are no more packages available because the current version of python is locked. If you now want to be able to update python again you can remove it from the list:

yum versionlock delete 0:python-2.6.6-51.el6.*
Note that you need to list the package exactly as in the versionlock list output.

YUM Component Groups

Yum also has the concept of components groups, which are collections of related software groupwd around a particular solution. The most common commands here are these:

yum grouplist
yum groupinfo
yum groupinstall
yum grouperase
yum groupupdate

Now, all these commands speak for themselves and can be quite useful. This is a list of available groups:

[root@localhost ~]# yum grouplist
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager, versionlock
This system is receiving updates from Red Hat Subscription Management.
Setting up Group Process
rhel-6-server-cf-tools-1-rpms                                                                                       | 2.8 kB     00:00
rhel-6-server-rpms                                                                                                  | 3.7 kB     00:00
Installed Groups:
   Additional Development
   Base
   Desktop
   Dial-up Networking Support
   Directory Client
   E-mail server
   FCoE Storage Client
   Fonts
   General Purpose Desktop
   Graphical Administration Tools
   Hardware monitoring utilities
   Internet Browser
   Legacy UNIX compatibility
   Legacy X Window System compatibility
   Network Infrastructure Server
   Networking Tools
   Performance Tools
   Perl Support
   Print Server
   Printing client
   SNMP Support
   Security Tools
   Storage Availability Tools
   Web Server
   X Window System
   iSCSI Storage Client
Installed Language Groups:
   Arabic Support [ar]
....
   Venda Support [ve]
Available Groups:
   Backup Client
   Backup Server
   CIFS file server
   Client management tools
   Compatibility libraries
   Console internet tools
   Debugging Tools
   Desktop Debugging and Performance Tools
   Desktop Platform
   Desktop Platform Development
   Development tools
   Directory Server
   Eclipse
   Emacs
   FTP server
   Graphics Creation Tools
   Identity Management Server
   Infiniband Support
   Input Methods
   Java Platform
   KDE Desktop
   Large Systems Performance
   Mainframe Access
   Messaging Client Support
   MySQL Database client
   MySQL Database server
   NFS file server
   Network Storage Server
   Network file system client
   PHP Support
   PostgreSQL Database client
   PostgreSQL Database server
   Remote Desktop Clients
   Ruby Support
   Scientific support
   Server Platform
   Server Platform Development
   Smart card support
   System Management
   System administration tools
   TeX support
   Technical Writing
   TurboGears application framework
   Virtualization
   Virtualization Client
   Virtualization Platform
   Virtualization Tools
   Web Servlet Engine
   Web-Based Enterprise Management
Available Language Groups:
   Afrikaans Support [af]
...
   Zulu Support [zu]
Done

Yum Downloader

yumdownloader <package>
yumdownloader --destdir=DESTDIR <package>

This downloads but does not install a package.

Yum Localinstall

yum localinstall <package>
yum localinstall <package> --nogpgcheck

This will install a local package but will install any dependency automatically from a repository. The –nogpgcheck option will disable the signature check if the package is not signed so you can still install the package.

RPM

Even though yum is a good software management system it is based on repositories. And even though you can create your own repository it will be nice if you can manage a piece of software that is not in a repository but is a simple download, ready for install. On Red Hat that's done with rpm, the Red Hat package manager. This is an overview of the most used rpm commands:

  • rpm -aq: lists all installed packages
  • rpm -qf <filename>: which package provides this filename
  • rpm -qi: compares to yum info
  • rpm -ql: list all files installed by the specified package
  • rpm -qc: list the configuration files
  • rpm -qd: list the documentation files
  • rpm -q –scripts: lists all shell scripts that is installed by a package
Note: you can add -p to also list information about non-installed packages

* repoquery -qi <package>: this also queries for information about a package but looks in the repositories instead of in the local database of installed packages

  • rpm -ivh <package>: installs the package but using this command is not preferred on red hat systems. Use the yum localinstall command instead.

Extra Information Regarding CPIO

RPM packages are essentially cpio archives. Cpio is an archiving tool but differs from tar that it reads it's input from STDIN instead of from command line arguments. This can be used to extract the files from a package.

This example shows how to download the initscripts package, extract the inittab from it and compare it to our current inittab to see the differences:

Make a directory and download the initscripts package:

[root@localhost ~]# mkdir iscripts
[root@localhost ~]# yumdownloader --destdir=/root/iscripts/ initscripts
Loaded plugins: product-id, refresh-packagekit, versionlock
rhel-6-server-cf-tools-1-rpms                                                                                       | 2.8 kB     00:00
rhel-6-server-rpms                                                                                                  | 3.7 kB     00:00
initscripts-9.03.40-2.el6_5.1.x86_64.rpm                                                                            | 940 kB     00:01

Exact the complete package into the cuurent directory:

[root@localhost ~]# cd iscripts/
[root@localhost iscripts]# rpm2cpio initscripts-9.03.40-2.el6_5.1.x86_64.rpm | cpio -idv
./bin/ipcalc
......
./var/run/netreport
11241 blocks
[root@localhost iscripts]# ll
total 968
drwxr-xr-x.  2 root root   4096 Apr  6 11:46 bin
drwxr-xr-x. 11 root root   4096 Apr  6 11:46 etc
-rw-r--r--.  1 root root 962668 Feb 13 06:06 initscripts-9.03.40-2.el6_5.1.x86_64.rpm
drwxr-xr-x.  3 root root   4096 Apr  6 11:46 lib
drwxr-xr-x.  2 root root   4096 Apr  6 11:46 sbin
drwxr-xr-x.  4 root root   4096 Apr  6 11:46 usr
drwxr-xr-x.  4 root root   4096 Apr  6 11:46 var

Or extract just the file you want to compare:

[root@localhost iscripts]# rpm2cpio initscripts-9.03.40-2.el6_5.1.x86_64.rpm | cpio -idv ./etc/inittab

Compare the two files:

[root@localhost iscripts]# diff ./etc/inittab /etc/inittab
26c26
< id:3:initdefault:
---
> id:5:initdefault:
You could leave a comment if you were logged in.
redhatsoftware.txt · Last modified: 2021/09/24 00:25 (external edit)