Yum and RPM Tips


To determine if a package is installed or use:

  • yum list <package name> # shows installed and available packages
  • rpm -qa |grep <package name> # shows installed packages only

To update a package:

  • yum -y update <package name>
  • rpm -Uvh <rpm file name>
If you are using rpm to install an updated kernel, always use the -ivh option; NEVER use -U or -F options with kernel installations


To update all installed packages:

  • yum -y update

To verify availability of yum repository:

  • yum list available

To find a package by partial name:

  • yum list '*partial-name*'
  • yum list installed '*partial-name*' # only list installed packages
  • rpm -qa |grep partial-name

To determine what files belong to a package with rpm:

  • rpm -ql <package name>

To determine the build host and installed size of packages:

  • rpm -qi <package name>
  • yum info <package name>

To verify an installed package:

  • rpm -V <package name>
      The format of the output is a  string  of  9  characters,  a  possible
attribute marker:
c %config configuration file.
d %doc documentation file.
g %ghost file (i.e. the file contents are not included in the package payload).
l %license license file.
r %readme readme file.
from the package header, followed by the file name. Each of the 8
characters denotes the result of a comparison of attribute(s) of the
file to the value of those attribute(s) recorded in the database. A
single "." (period) means the test passed, while a single "?" (ques-
tion mark) indicates the test could not be performed (e.g. file per-
missions prevent reading). Otherwise, the (mnemonically emBoldened)
character denotes failure of the corresponding --verify test:
S file Size differs
M Mode differs (includes permissions and file type)
5 MD5 sum differs
D Device major/minor number mismatch
L readLink(2) path mismatch
U User ownership differs
G Group ownership differs
T mTime differs
C selinux Context differs

To determine which package installed a file:

  • rpm -qf <file name>
  • For example, rpm -qf /etc/mail/sendmail.cf
  • Output: sendmail-8.13.1-3.3.el4
  • yum provides <file name>


No comments: