rpm tips

RPM-Tips
Donnie Barnes, djb@redhat.com
V1.0, February 16, 1996

1.  Preface

``Red Hat Tips'' are documentation meant to help Red Hat users with
specific tasks.  Some of these documents are for new users, some are
for advanced users.  Hopefully each document will also be of help for
both new and advanced users.  If you have contributions to make,
please send them to tech-sup@redhat.com.  If you have changes that
need to be made to individual Tips, send them to the author of that
document.



2.  Introduction


RPM is the Red Hat Package Manager.  The RPM system is used to
manipulate individual software packages.  These packages, called RPMs,
can be installed, uninstalled, queried and verified.  This document
will introduce you to the most basic (and most frequently used) RPM
commands.

Releases 2.0 and 2.1 of Red Hat Linux were shipped with RPM version
1.X.  By the time you read this, RPM 2.0 should be released with many
new features and improvements.


3.  RPM Packages


By convention, RPMs are named as follows:



     name-version-release.arch.rpm




Name and version are the name and version of the software.  Release is
the release number of the package (sometimes there are many releases
of a package of the same version of software).  Arch denotes the
specific architecture the package was built on.  For example, i386
denotes Intel based machines, axp denotes Digital Alpha based
machines.


4.  Querying


The -q option specifies query mode.

The following options specify information you want:



            Name, version, release
     -i              Name, description, builder, build date, etc
     -l              List of files in package
     -d              List of documentation
     -c              List of configuration files


The following options specify what packages you want to query:



     name            Installed package name
     -a              All installed packages
     -f file         Installed package owning file
     -p package      Query RPM package




Combine one of each of the above options to form a query.  For
example, to list all the packages installed on your system:



     rpm -qa




To list all the configuration files enter:



     rpm -qac




To list all the documentation in the package owning /usr/bin/jed
enter:



     rpm -qdf /usr/bin/jed





5.  Installing


Use the -i option to install a package:



     rpm -i foo-1.0-1.i386.rpm




One neat set of options is -vh which prints a bar of hash marks as the
package installs:



     rpm -ivh foo-1.0-1.i386.rpm






6.  Verifying


Verifying packages can be a very enlightenting experience.  To verify,
use -V along with one of the ``package selection options'' listed in
the Querying section.  For instance, if you are having trouble with
the Emacs package, and can not figure out the problem, one of the
first things you might do is verify the package:



     rpm -Vf /usr/bin/emacs




If any anomolies are reported, you should rerun the verification in
verbose mode with -v:



     rpm -Vvf /usr/bin/emacs




This will list the exact discrepencies the rpm finds, including
changed permission, owners, groups, file sizes, etc.  Sometimes, these
changes are normal and are not cause for alarm.  For instance, if you
modify a configuration file, the verification will report it, but it
is not necessarily a problem.  The /dev/tty* files are another
example.  These files change ownership as users log in and out, so
changes in ownership may not be cause for alarm.


7.  Uninstalling


To uninstall a package use -u and the package name:



     rpm -u emacs




Note that the package name is not the name of the RPM package you
installed, that is, it is not emacs-19.30-1.i386.rpm.


8.  Upgrading


To upgrade to a new package use -U and the RPM package file name:



     rpm -U emacs-20.0-1.i386.rpm




This will install the new package, and uninstall any older emacs
packages.  If there were configuration files that you modified in the
old package, your files will be saved to backup names, and RPM will
notify you.  If this happens you should investigate your configuration
file and the new one, and perhaps incorporate your changes into the
new version.


9.  Finding RPMs


Many RPM packages are available at:



     ftp://ftp.redhat.com/current
     ftp://ftp.redhat.com/contrib
     ftp://ftp.redhat.com/non-free




Once you are connected to ftp.redhat.com you can also search for a
particular filename.  If I was looking for a kermit RPM I would enter:



     site exec locate kermit




and the system would display the location of the kermit RPM.


10.  Further Reading


More documentation on RPM, including instructions for building your
own RPM packages, can be found by reading the man page, the RPM-HOWTO
(http://www.redhat.com), and a paper presented at the 1996 Free
Software Conference (ftp://ftp.redhat.com).


11.  Copyright Notice

This document is Copyright (C) 1996 by Red Hat Software.
Redistribution of this document is permitted as long as the content
remains completely intact and unchanged.  In other words, you may
reformat and reprint or redistribute only.


Last Modified: 16 March 1996

St. Louis Unix Users Group - Linux SIG