rpm

Section: Red Hat Linux (8)
Updated: 15 July 1996
Index Return to Main Contents
 

NAME

rpm - Red Hat Package Manager  

SYNOPSIS

rpm [options]  

DESCRIPTION

rpm is a powerful package manager, which can be used to build, install, query, verify, update, and uninstall individual software packages. A package consists of an archive of files, and package information, including name, version, and description.

There are seven basic modes of operation, and each takes a different set of options. They are Install, Query, Verify, Signature check, Uninstall, Build, and Rebuild Database.

Install mode:
rpm -i [install-options] <package_file>+
Query mode:
rpm -q [query-options]
Verify mode:
rpm -V|-y|--verify [verify-options]
Signature Check mode:
rpm --checksig <package_file>+
Uninstall mode:
rpm -e <package_name>+
Build mode:
rpm -bO [build-options] <package_spec>+

 

GENERAL OPTIONS

These options can be used in all the different modes.
-vv
Print lots of ugly debugging information.
--keep-temps
Do not remove temporary files (/tmp/rpm-*). Primarily only useful for debugging rpm.
--quiet
Print as little as possible - normally only error messages will be displayed.
--help
Print a longer usage message then normal.
--version
Print a single line containing the version number of rpm being used.
--rcfile <file>
Use <file> instead of /etc/rpmrc and $HOME/.rpmrc.
--root <dir>
Use the directory given as top level directory for all operations.

 

INSTALL OPTIONS

The general form of an rpm install command is

       rpm -i [install-options] <package_file>+

--force
Same as using both --replacepkgs, --replacefiles, and --oldpackage.
-h, --hash
Print 50 hash marks as the package archive is unpacked. Use with -v for a nice display.
--oldpackage
Allow an upgrade to replace a newer package with an older one.
--percent
Print percentages as files are unpacked from the package archive. This is intended to make RPM easy to run from other tools.
--replacefiles
Install the packages even if they replace files from other, already installed, packages.
--replacepkgs
Install the packages even if some of them are already installed on this system.
--root <dir>
Do the installation on the system rooted at <dir>. Note that this means the database will be updated under <dir> and any pre or post scripts are run after a chroot() to <dir>.
--noscripts
Don't execute the preinstall or postinstall scripts.
--excludedocs
Don't install any files which are marked as documentation (which includes man pages and texinfo documents).
--includedocs
Install documentation files. This is only needed if excludedocs: 1 is specified in an rpmrc file.
--nodeps
Don't check dependencies before installing the packages.
--test
Do not install the package, simply check for and report potential conflicts.
-U, --upgrade
Upgrade the package currently installed to the version in the new RPM. This is the same as install, except all other version of the package are removed from the system.

 

QUERY OPTIONS

The general form of an rpm query command is

       rpm -q [query-options]

You may specify the format that package information should be printed in. To do this, you use the --queryformat option, followed by the format string.

Query formats are modifed versions of the standard printf(3) formatting. The format is made up of static strings (which may include standard C character escapes for newlines, tabs, and other special characters) and printf(3) type formatters. As rpm already knows the type to print, the type specifier must be omitted however, and replaced by the name of the header tag to be printed, enclosed by {} characters. The RPMTAG_ portion of the tag name may be omitted, and the tag name may be preceded by a - to format the tag as a date if possible.

For example, to print only the names of the packages queried, you could use %{NAME} as the format string. To print the packages name and distribution information in two columns, you could use %-30{NAME}%{DISTRIBUTION}.

rpm will print a list of all of the tags it knows about when it is invoked with the --querytags argument.

There are two subsets of options for querying: package selection, and information selection.

Package selection options:

<package_name>
Query package named <package_name>.
-a
Query all packages
-whatrequires <capability>
Query all packages that requires <capability> for proper functioning.
-whatprovides <virtual>
Query all packages that provide the <virtual> capability.
-f <file>
Query package owning <file>.
-F
Like -f but read file names from stdin.
-p <package_file>
Query an (uninstalled) package <package_file>.
-P
Like -p but read package file names from stdin.

Information selection options:

-i
Display package information, including name, version, and description. This uses the --queryformat if one was specified.
-R
List packages this one depends on (same as --requires).
--provides
List capabilities this package provides.
-l
List files in package.
-s
Display the states of files in the package (implies -l). The state of each file is either normal, not installed, or replaced.
-d
List only documentation files (implies -l).
-c
List only configuration files (implies -l).
--scripts
List the package specific shell scripts that are used as part of the installation and uninstallation processes, if there are any.
--dump
Dump file information as follows: path size mtime md5sum mode owner group isconfig isdoc rdev symlink. This must be used with at least one of -l, -c, -d.

 

VERIFY OPTIONS

The general form of an rpm verify command is

       rpm -V|-y|--verify [verify-options]

Verifying a package compares information about the installed files in the package with information about the files taken from the original package and stored in the rpm database. Among other things, verifying compares the size, MD5 sum, permissions, type, owner and group of each file. Any discrepencies are displayed. The package specification options are the same as for package querying.

The format of the output is a string of 8 characters, a possible "c" denoting a configuration file, and then the file name. Each of the 8 characters denotes the result of a comparison of one attribute of the file to the value of that attribute recorded in the RPM database. A single "." (period) means the test passed. The following characters denote failure of certain tests:

5
MD5 sum
S
File size
L
Symlink
T
Mtime
D
Device
U
User
G
Group
M
Mode (includes permissions and file type)

 

SIGNATURE CHECKING

The general form of an rpm signature check command is

       rpm --checksig <package_file>+

This checks the PGP signature built into a package to ensure the integrity and the origin of the package. PGP configuration information is read from /etc/rpmrc. See the section on PGP SIGNATURES for details.

 

UNINSTALL OPTIONS

The general form of an rpm uninstall command is

        rpm -e <package_name>+

--noscripts
Don't execute the preuninstall or postuninstall scripts.
--nodeps
Don't check dependencies before uninstalling the packages.
--test
Don't really uninstall anything, just go through the motions. -vv option.

 

BUILD OPTIONS

The general form of an rpm build command is


    rpm -bO [build-options] <package_spec>+

where -bO specifies the stages of building and packaging to be done and is one of:

-bp
Executes the "%prep" stage from the spec file. Normally this involves unpacking the sources and applying any patches.
-bl
Do a "list check". The "%files" section from the spec file is macro expanded, and checks are made to insure the files exist.
-bc
Do the "%build" stage from the spec file (after doing the prep stage). This generally involves the equivalent of a "make".
-bi
Do the "%install" stage from the spec file (after doing the prep and build stages). This generally involves the equivalent of a "make install".
-bb
Build a binary package (after doing the prep, build, and install stages).
-ba
Build binary and source packages (after doing the prep, build, and install stages).

The following options may also be used:

--short-circuit
Skip straight to specified stage (ie, skip all stages leading up to the specified stage). Only valid with -bc and -bi.
--timecheck
Set the "timecheck" age (0 to disable). This value can also be set in rpmrc with "timecheck:". The timecheck value expresses, in seconds, the maximum age of a file being packaged. Warnings will be printed for all files beyond the timecheck age.
--clean
Remove the build tree after the packages are made.
--test
Do not execute any build stages. Useful for testing out spec files.
--sign
Embed a PGP signature in the package. This signature can be used to verify the integrity and the origin of the package. See the section on PGP SIGNATURES for /etc/rpmrc details.

 

REBUILD AND RECOMPILE OPTIONS

There are two other ways to invoke rpm:

rpm --recompile <source_package_file>+

rpm --rebuild <source_package_file>+

When invoked this way, rpm installs the named source package, and does a prep, compile and install. In addition, --rebuild builds a new binary package. When the build has completed, the build directory is removed (as in --clean) and the the sources and spec file for the package are removed.

 

SIGNING AN EXISTING RPM

rpm --resign <binary_package_file>+

This option generates and inserts new signatures for the listed packages. Any existing signatures are removed.

 

PGP SIGNATURES

In order to use the signature feature RPM must be able to run PGP (it must be installed and in your path), and it must be able to find a public key ring with RPM public keys in it. By default, RPM uses the PGP defaults to find the keyrings (honoring PGPPATH). If your key rings are not located where PGP expects them to be, you must set the following in your /etc/rpmrc

pgp_path
Replacement path for /usr/lib/rpm. Must contain your key rings.

If you want to be able to sign packages you create yourself, you also need to create your own public and secret key pair (see the PGP manual). In addition to the above /etc/rpmrc entries, you should add the following:

signature
The signature type. Right now only pgp is supported.
pgp_name
The name of the "user" whose key you wish to use to sign your packages.

When building packages you then add --sign to the command line. You will be prompted for your pass phrase, and your package will be built and signed.

 

REBUILD DATABASE OPTIONS

The general form of an rpm rebuild database command is

       rpm --rebuilddb

The only options this mode supports are --dbpath and --root.

 

FILES

/etc/rpmrc
~/.rpmrc
/var/lib/rpm/packages
/var/lib/rpm/pathidx
/var/lib/rpm/nameidx
/tmp/rpm*

 

SEE ALSO

glint(8), rpm2cpio(8), http://www.redhat.com/rpm
 

AUTHORS

Marc Ewing <marc@redhat.com>
Erik Troan <ewt@redhat.com>


 

Index

NAME
SYNOPSIS
DESCRIPTION
GENERAL OPTIONS
INSTALL OPTIONS
QUERY OPTIONS
VERIFY OPTIONS
SIGNATURE CHECKING
UNINSTALL OPTIONS
BUILD OPTIONS
REBUILD AND RECOMPILE OPTIONS
SIGNING AN EXISTING RPM
PGP SIGNATURES
REBUILD DATABASE OPTIONS
FILES
SEE ALSO
AUTHORS

This document was created by man2html, using the manual pages.
Time: 15:33:23 GMT, January 15, 2023