rpm

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

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 ten basic modes of operation, and each takes a different set of options. They are Install, Query, Verify, Signature check, Uninstall, Build, Rebuild Database, fix permissions, set owners and groups, and Show RC.

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 -[b|t]
O [build-options] <package_spec>+
Rebuild database:
rpm --rebuilddb

Fix permissions:
rpm --setperms [query-package-specifiers]

Set owners and groups:
rpm --setugids [query-package-specifiers]

Show RC:
rpm --showrc

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 system rooted at <dir> for all operations. Note that this means the database will be read or modified under <dir> and any pre or post scripts are run after a chroot() to <dir>.

--dbpath <path>

Use RPM database in <path>.

--ftpproxy <host>

Use <host> as an FTP proxy. See FTP OPTIONS.

--ftpport <port>

Use <port> as the FTP port. See FTP OPTIONS.

INSTALL AND UPGRADE OPTIONS

The general form of an rpm install command is

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

This installs a new package. The general form of an rpm upgrade command is

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

This upgrades or installs 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.

The <package_file> may be specified as an ftp style URL, in which case the package will be downloaded before being installed. See FTP OPTIONS for information on RPM’s built in ftp support.
--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.

--allfiles

Installs or upgrades all the missingok files in the package, regardless if they exist.

--nodeps

Don’t do a dependency check before installing to upgrading a package.

--noscripts

Don’t execute the preinstall or postinstall scripts.

--notriggers

Don’t execute scripts which are triggered by the installation of this package.

--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.

--test

Do not install the package, simply check for and report potential conflicts.

--prefix <path>

This sets the installation prefix to <path> for relocatable packages.

--ignorearch

This allows installation or upgrading even if the architectures of the binary RPM and host don’t match.

--ignoreos

This allows installation or upgrading even if the operating systems of the binary RPM and host don’t match.

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.

Alternate output formats may be requested by following the tag with :typetag. Currently, the following types are supported: octal, date, shescape, perms, fflags, and depflags.

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 installed package named <package_name>.

-a

Query all installed 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>.

-p <package_file>

Query an (uninstalled) package <package_file>. The <package_file> may be specified as an ftp style URL, in which case the package header will be downloaded and queried. See FTP OPTIONS for information on RPM’s built in ftp support.

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.

--changelog

Display change information for the package.

-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.

Files that were not installed from the package, for example documentation files excluded on installation using the "--excludedocs" option, will be silently ignored.

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>+
--allmatches

Remove all versions of the package which match <package_name>. Normally an error is issued if <package_name> matches multiple packages.

--noscripts

Don’t execute the preuninstall or postuninstall scripts.

--notriggers

Don’t execute scripts which are triggered by the removal of this package.

--nodeps

Don’t check dependencies before uninstalling the packages.

--test

Don’t really uninstall anything, just go through the motions. -vv option.

--nodeps

Don’t check for broken dependencies before removing the package.

BUILD OPTIONS

The general form of an rpm build command is

rpm -[b|t]O [build-options] <package_spec>+

The argument used is -b if a spec file is being used to build the package and -t if RPM should look inside of a gzipped (or compressed) tar file for the spec file to use. After the first argument, the next argument (O) 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.

--rmsource

Remove the sources and spec file after the build (may also be used standalone, eg. "rpm --rmsource foo.spec").

--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.

SHOWRC

Running

rpm --showrc

shows the values RPM will use for all of the options that may be set in rpmrc files.

FTP OPTIONS

RPM includes a simple FTP client to simplify installing and querying packages which are available over the internet. Package files for install, upgrade, and query operations may be specified as an ftp style URL:

ftp://<user>:<password>@hostname/path/to/package.rpm

If the @password portion is omitted, the password will be prompted for (once per user/hostname pair). If both the user and password are omitted, anonymous ftp is used. In all cases passive (PASV) ftp transfers are used.

RPM allows the folowing options to be used with ftp URLs:
--ftpproxy <hostname>

The host <hostname> will be used as a proxy server for all transfers, which allows users to ftp through firewall machines which use proxy systems. This option may also be specified in an rpmrc file.

--ftpport <port>

Specifies the TCP port number to use for the ftp connection instead of the default port. This option may also be specified in an rpmrc file.

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>