Tech Support Notes

Yum

The yum utility is a software package manager that installs, updates, and removes packages on RPM-based systems. It automatically computes dependencies and figures out what things should occur to install packages. yum makes it easier to maintain groups of machines without having to manually update each one using rpm.

yum install

Install a software package using yum. You can use -y to accept Yes at the install prompt, but unless you are willing to take the chance don't include it.

yum install nmap
yum install nmap -y

yum remove

To remove all packages, including all dependencies. Again, you can use -y to accept Yes at the Remove prompt, but unless you are willing to take the chance don't include it.

yum remove nmap
yum remove nmap -y

yum grouplist

To view 'groups' of packages that can be installed as a group or all at once. In this example we will search for any "server" package groups that can be installed:

[io] (~) >>> yum grouplist|grep -i server
   E-mail server
   Backup Server
   CIFS file server
   Directory Server
   FTP server
   Identity Management Server
   MySQL Database server
   NFS file server
   Network Infrastructure Server
   Network Storage Server
   PostgreSQL Database server
   Print Server
   Server Platform
   Server Platform Development
   Systems Management Messaging Server support
   Web Server

yum groupinfo

To see the description and package list of a package group use groupinfo:

[io] (~) >>> yum groupinfo "NFS file server"
Loaded plugins: fastestmirror
Setting up Group Process
Loading mirror speeds from cached hostfile
 * base: centos.mirrors.hoobly.com
 * epel: linux.mirrors.es.net
 * extras: mirrors.versaweb.com
 * updates: mirrors.sonic.net

Group: NFS file server
 Description: NFS file server.
 Mandatory Packages:
   nfs-utils
   nfs4-acl-tools

yum groupinstall

To install specific package groups run the following:

[io] (~) >>> yum groupinstall "NFS file server"
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirrors.hoobly.com
 * epel: linux.mirrors.es.net
 * extras: mirrors.versaweb.com
 * updates: mirrors.sonic.net
Setting up Group Process
Checking for new repos for mirrors
Resolving Dependencies
--> Running transaction check
---> Package nfs-utils.x86_64 1:1.2.3-36.el6 will be installed
--> Processing Dependency: nfs-utils-lib >= 1.1.0-3 for package: 1:nfs-utils-1.2.3-36.el6.x86_64
--> Processing Dependency: keyutils >= 1.4-4 for package: 1:nfs-utils-1.2.3-36.el6.x86_64
--> Processing Dependency: rpcbind for package: 1:nfs-utils-1.2.3-36.el6.x86_64
--> Processing Dependency: libtirpc for package: 1:nfs-utils-1.2.3-36.el6.x86_64
--> Processing Dependency: libgssglue.so.1(libgssapi_CITI_2)(64bit) for package: 1:nfs-utils-1.2.3-36.el6.x86_64
--> Processing Dependency: libgssglue for package: 1:nfs-utils-1.2.3-36.el6.x86_64
--> Processing Dependency: libevent for package: 1:nfs-utils-1.2.3-36.el6.x86_64
--> Processing Dependency: libtirpc.so.1()(64bit) for package: 1:nfs-utils-1.2.3-36.el6.x86_64
--> Processing Dependency: libnfsidmap.so.0()(64bit) for package: 1:nfs-utils-1.2.3-36.el6.x86_64
--> Processing Dependency: libgssglue.so.1()(64bit) for package: 1:nfs-utils-1.2.3-36.el6.x86_64
--> Processing Dependency: libevent-1.4.so.2()(64bit) for package: 1:nfs-utils-1.2.3-36.el6.x86_64
---> Package nfs4-acl-tools.x86_64 0:0.3.3-6.el6 will be installed
--> Running transaction check
---> Package keyutils.x86_64 0:1.4-4.el6 will be installed
---> Package libevent.x86_64 0:1.4.13-4.el6 will be installed
---> Package libgssglue.x86_64 0:0.1-11.el6 will be installed
---> Package libtirpc.x86_64 0:0.2.1-6.el6_4 will be installed
---> Package nfs-utils-lib.x86_64 0:1.1.5-6.el6 will be installed
---> Package rpcbind.x86_64 0:0.2.0-11.el6 will be installed
--> Finished Dependency Resolution
blah ... blah ... blah

yum search/list

To find packages that can be installed using yum you can use yum search or yum list. By default 'yum list' without any options will list all packages in all the repositories and all the packages installed on your system.

[callisto] (~) >>> yum search iftop
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirrors.service.networklayer.com
 * extras: mirrors.service.networklayer.com
 * updates: mirrors.service.networklayer.com
base                                                                                                                          | 3.7 kB     00:00
extras                                                                                                                        | 3.4 kB     00:00
updates                                                                                                                       | 3.4 kB     00:00
================================================================ N/S Matched: iftop =================================================================
iftop.x86_64 : iftop - display bandwidth usage on an interface by host

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

[callisto] (~) >>> yum list|grep iftop
iftop.x86_64                               0.17-1.el6                  @/iftop.x86_64

If you're searching for what package provides a certain command try yum provides instead.

[callisto] (~) >>> yum provides MTA
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirrors.service.networklayer.com
 * extras: mirrors.service.networklayer.com
 * updates: mirrors.service.networklayer.com
2:postfix-2.6.6-2.2.el6_1.x86_64 : Postfix Mail Transport Agent
Repo        : base
Matched from:
Other       : MTA



2:postfix-2.6.6-6.el6_5.x86_64 : Postfix Mail Transport Agent
Repo        : updates
Matched from:
Other       : MTA



sendmail-8.14.4-8.el6.x86_64 : A widely used Mail Transport Agent (MTA)
Repo        : base
Matched from:
Other       : MTA

yum downgrade

Will try and downgrade a package from the version currently installed to the previously highest version (or the specified version). The depsolver will not necessarily work, but if you specify all the packages it should work (and thus. all the simple cases will work). Also this does not work for "installonly" packages, like Kernels. downgrade operates on groups, files, provides and filelists just like the "install" command.

yum history list

The yum history command lists all latest yum operations and yum history list lists all operations or just selected package operations.


% sudo yum history list

Loaded plugins: fastestmirror
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    41 | root               | 2015-03-26 00:58 | Update         |    2  <
    40 |                    | 2015-03-25 17:08 | Install        |    1 >
    39 | root               | 2015-03-24 01:00 | Update         |    3  <
    38 |                    | 2015-03-23 14:17 | Install        |    1 >
    37 | root               | 2015-03-19 00:57 | Update         |    3
    36 | root               | 2015-03-13 00:57 | I, U           |    3
    35 | root               | 2015-03-12 00:57 | Update         |    6
    34 |                    | 2015-03-06 15:45 | Install        |    2
    33 |                    | 2015-03-06 15:45 | Install        |    1
    32 | root               | 2015-03-03 00:57 | Update         |    3  <
    31 |                    | 2015-02-26 12:46 | Install        |    2 ><
    30 |                    | 2015-02-25 11:58 | Install        |    1 ><
    29 | root               | 2015-02-11 00:57 | Update         |    1 >
    28 | root               | 2015-02-07 00:57 | Update         |    1
    27 | root               | 2015-02-06 00:58 | Update         |    3
    26 |                    | 2015-02-05 11:00 | Install        |    2  <
    25 |                    | 2015-02-05 10:59 | Install        |   30 ><
    24 | root               | 2015-02-05 00:57 | Install        |    5 >
    23 |                    | 2015-02-02 19:20 | Install        |    2
    22 |                    | 2015-02-02 19:19 | Install        |    1

% sudo yum history list jwhois                                                                                                                   1 ↵
Loaded plugins: fastestmirror
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    40 |                    | 2015-03-25 17:08 | Install        |    1
history list

The ID of the transaction to install jwhois is 40 so we can get more specific information about the install by using the yum history info command with that ID.


% sudo yum history info 40
Loaded plugins: fastestmirror
Transaction ID : 40
Begin time     : Wed Mar 25 17:08:23 2015
Begin rpmdb    : 1518:bf690fa96d7c6959bee9d4a6b1ea02cfcf5a5622
End time       :            17:08:25 2015 (2 seconds)
End rpmdb      : 1519:88654212da0ea4494d2e844d1bbb1098f2835c15
User           :  
Return-Code    : Success
Command Line   : install jwhois
Transaction performed with:
    Installed     rpm-4.8.0-38.el6_6.x86_64                     @updates
    Installed     yum-3.2.29-60.el6.centos.noarch               @base
    Installed     yum-plugin-fastestmirror-1.1.30-30.el6.noarch @base
Packages Altered:
    Install jwhois-4.0-19.el6.x86_64 @base
history info

Yum Tips and Tricks
Yum commands