Appendix A

RPM Command Reference

In This Appendix

*	rpm command

*	rpmbuild command

This appendix covers the syntax of the command-line options for the rpm and rpmbuild commands.

The rpm Command

The rpm command is the workhorse of the RPM system. The following sections cover options for the major operations with the rpm command.

Table A-1 lists the query options for the rpm command.

Table A-1 rpm query options with –q or --query

Option	Usage
-a, --all	Query all packages
-c, --configfiles	List configuration files
--changelog	List changelog entries
--conflicts	List capabilities this package conflicts with
-d, --docfiles	List documentation files
--dump	Dump out extra information on files.
-f, --file filename	Query for packages owning given file
--filesbypapkg	List all files in each selected package
--fileid md5_id	Query for the package with the given MD5 digest
-g, --group group_name	Query packages in the given group
--hdrid sha1_header_id	Query for the package with the given header identifier number, in SHA1 format
-i, --info	Display a lot of package information including description
--last	Reorder the output of the rpm command to show the most recently installed packages first
--obsoletes	List capabilities this package obsoletes
-p, --package rpm_file	Query the given package file or files
--pkgid md5_id	Query for the package with the given MD5 package ID
--provides	List capabilities provided by package
--querybynumber number	Query for the given entry, by number, in the RPM database
--qf, --queryformat format	Use the given query format for displaying the output
--redhatprovides capability	Look in rpmdb-redhat database for packages that provide the given capability
--redhatrequires capability	Look in rpmdb-redhat database for packages that require the given capability
-R, --requires	Lists packages and capabilities that this package depends on
--specfile specfile	Query the given spec file
-s, --state	Display the state of the listed files
--scripts	List scripts in the package
--tid transaction_id	Query for the package or packages with the given transaction ID
--triggeredby package	Query packages triggered by the given package
--triggers, --triggerscripts	List trigger scripts
--whatrequires capability	Query packages that require the given capability
--whatprovides capability	List packages that provide the given capability

Upgrade, freshen, and install options

Table A-2 lists the upgrade, freshen, and installation options for the rpm command.

Table A-2 rpm upgrade, freshen, and install options

Option	Usage
--aid	Add any suggested packages to the list to install or upgrade
--allfiles	Install all the files, even if some might otherwise be skipped
--badreloc	Relocate files even if the package is not relocatable
--excludedocs	Skip the files marked as documentation
--excludepath path	Skip files that begin with path
--force	A short hand for --replacepkgs and --replacefiles
-h, --hash	Print hash marks, #, periodically while performing operation to provide some feedback
--ignorearch	Ignore the architecture listed in the package
--ignoreos	Ignore the operating system listed in the package
--ignoresize	Skip the check to see if there is enough disk space to install the package
--includedocs	Install files marked as documentation, turned on by default
--justdb	Just update the RPM database, do not modify any files
--nodeps	Skip verification of package dependencies
--nodigest	Skip verification of package and header digests
--nomd5	Skip verification of file MD5 checksums
--noorder	Do not reorder the list of packages to be installed based on dependencies
--nopost	Do not run post-install scripts
--nopostun	Do not run post-uninstall scripts
--nopre	Do not run pre-install scripts
--nopreun	Do not run pre-uninstall scripts
--nosuggest	Do not suggest packages for missing dependencies
--noscripts	Do not execute scripts
--nosignature	Skip verification of package and header signatures
--notriggers	Do not execute trigger scripts
--notriggerin	Do not run trigger install scripts
--notriggerpostun	Do not run trigger post uninstall scripts
--notriggerun	Do not run trigger uninstall scripts
--oldpackage	Allow an upgrade to an older version of a package
--percent	Print out percentage of work completed as command executes
--prefix directory	Relocate package to directory, if package is relocatable
--relocate old=new	Relocate all paths that start with old to new, if relocatable
--repackage	Create a package from any files that would be erased
--replacefiles	Install package even if it replaces files from other packages
--replacepkgs	Install packages even if they are already installed
--test	Do not install or remove packages, just see if the command would work

Use rpm –U or --upgrade to upgrade, rpm –i or --install to install, and –F or --freshen to freshen a package.

Erase options

Table A-3 lists the erase, or package removal, options for the rpm command.

Table A-3 rpm erase (removal) options with –e or --erase

Option	Usage
--allmatches	Remove all versions of the packages; normally an error would occur if there is more than one package of the same name and you try to erase the package
--nodeps	Skip verification of package dependencies
--noscripts	Do not execute scripts
--nopostun	Do not run post-uninstall scripts
--nopreun	Do not run pre-uninstall scripts
--notriggers	Do not execute trigger scripts
--notriggerpostun	Do not run trigger post uninstall scripts
--notriggerun	Do not run trigger uninstall scripts
--repackage	Create a package from any files that would be erased
--test	Do not install or remove packages, just see if the command would work

Signature options

Table A-4 lists the signature-related options to the rpm command.

Table A-4 rpm signature options with –K, --checksig, or --import

Option	Usage
--addsign	Sign packages, same as --resign
--import public_key	Add given public key to the RPM database
--nodigest	Skip verification of package and header digests
--nosignature	Skip verification of package and header signatures
--resign	Sign packages

The --import option works on its own. The rest of the options work with one or more RPM packages.

Verify options

The rpm command can verify packages. This involves comparing all files installed by the package with the information in the RPM database, and looking for differences or missing files.

Table A-5 lists the verify options to the rpm command.

Table A-5 rpm verify options with –V or --verify

Option	Usage
-a, --all	Verify all packages
-f, --file filename	Verify packages owning given file
-g, --group group_name	Verify packages in the given group
--nodeps	Skip verification of package dependencies
--nodigest	Skip verification of package and header digests
--nofiles	Do not verify the files in the package
--nogroup	Do not verify the group owner
--nolinkto	Do not verify the link file attribute
--nomd5	Skip verification of file MD5 checksums
--nomtime	Do not verify the mtime attribute
--nomode	Do not verify the file mode (permissions)
--nordev	Do not verify the rdev attribute
--noscripts	Do not execute the verify scripts
--nosignature	Skip verification of package and header signatures
--nosize	Do not verify the file size
--nouser	Do not verify the owner of the file
-p, --package rpm_file	Verify the given package file or files
--specfile specfile	Verify the given spec file
--whatrequires capability	Verify packages that require the given capability
--whatprovides capability	Verify packages that provide the given capability

Database options

You can create a new, empty, RPM database as well as rebuild all the inverted lists used for quick access using the database options listed in Table A-6.

Table A-6 rpm database options

Option	Usage
--initdb	Initialize database
--rebuilddb	Rebuild all the inverted lists from the Packages file

Miscellaneous options

These options can be used with any rpm command. Three of the options, --querytags, --version, and --showrc, run on their own. The rest can be used with the other rpm options. Table A-7 lists these miscellaneous options.

Table A-7 Miscellaneous rpm options

Option	Usage
-?, --help	Print the popt help information for all the command-line options
--dbpath path_to_rpm_db	Use the given directory for the RPM database, instead of the default
-D, --define 'macro value'	Define the given macro to hold the given value
-E, --eval expression	Print the evaluation of the given expression
--ftpport port	Use the given port number for FTP access
--ftpproxy host	Use the given host name as a proxy for FTP access
--httpport port	Use the given port number for HTTP access
--httpproxy host	Use the given host name as a proxy for HTTP access
--macros file:file:file	Read the given colon-separated files as the macro files to define RPM macros; only the first file must exist
--pipe command	Pipe the output of the rpm command to the given command
--querytags	Print the query tag names and exit
--quiet	Provide less output, normally show only errors
--rcfile file:file:file	Read the given colon-separated files as the rc files to define RPM settings; only the first file must exist
--root directory	Use directory as the top-level directory instead of /.
--showrc	Print the rpmrc and macro configuration and exit
-v, --verbose	Provide more verbose output
-vv	Provide even more verbose output, including debugging information
--version	Print the RPM version and exit

The rpmbuild Command

The rpmbuild command builds RPMs. Most of the options are duplicated. The options that begin with –b build from a spec file, and the options that begin with –t build from a compressed tar archive, commonly called a tarball.

Building from a spec file

Table A-8 lists the rpmbuild options for building RPMs from a spec file.

Table A-8 Options for building RPMs from a spec file

Option	Usage
-ba	Build all, both a binary and source RPM
-bb	Build a binary RPM
-bc	Build (compile) the program but do not make the full RPM, by executing the build commands through the %build section and stopping
-bp	Prepare for building a binary RPM, by executing the build commands through the %prep section and stopping
-bi	Execute the build commands through the %install section and stop
-bl	Check the listing of files for the RPM
-bs	Build a source RPM only

Each of these options requires the name of a spec file at the end of the command line.

Building from a compressed tar archive

Table A-9 lists the rpmbuild options for working with a compressed tar archive.

Table A-9 Options for building RPMs from a compressed tar archive

Option	Usage
-ta	Build all, both a binary and source RPM
-tb	Build a binary RPM
-tc	Build (compile) the program but do not make the full RPM, by executing the build commands through the %build section and stopping
-tp	Prepare for building a binary RPM, by executing the build commands through the %prep section and stopping
-ti	Execute the build commands through the %install section and stop
-tl	Check the listing of files for the RPM
-ts	Build a source RPM only

Each of these options requires the name of a compressed tar archive at the end of the command line. The tar archive must contain a valid spec file inside the archive.

Rebuilding RPMs from source RPMs

You can use the rpmbuild command to rebuild an RPM from a source RPM with the options listed in Table A-10.

Table A-10 Options for rebuilding RPMs from source RPMs

Option	Usage
--rebuild	Rebuild binary RPM from source RPM
--recompile	Recompile binary RPM from source RPM

Each of these options requires the name of a source RPM file on the end of the command line.

Customizing the build

You can customize the rpmbuild command with the options listed in Table A-11.

Table A-11 Extra build options for the rpmbuild command

Option	Usage
-?, --help	Print the popt help information for all the command-line options
--buildroot directory	Override the default root directory for building with directory.
--clean	Remove the build tree after building
-D, --define 'macro value'	Define the given macro to hold the given value
--dbpath path_to_rpm_db	Use the given directory for the RPM database instead of the default
-E, --eval expression	Print the evaluation of the given expression
--macros file:file:file	Read the given colon-separated files as the macro files to define RPM macros; only the first file must exist
--nobuild	Don't really build anything, which really tests the spec file
--pipe command	Pipe the output of the rpm command to the given command
--quiet	Provide less output, normally show only errors
--rcfile file:file:file	Read the given colon-separated files as the rc files to define RPM settings; only the first file must exist
--rmsource	Remove the sources after the build
--rmspec	Remove the spec file after the build
--root directory	Use directory as the top-level directory instead of /
--short-circuit	With the -bc or -bi options, jumps directly to the given stage and just executes that stage
--showrc	Print the rpmrc and macro configuration and exit
--sign	Sign the package with a GPG signature
--target platform	Build for the given platform. May not work if you don't have the other platform build commands, such as cross compilers, set up. Can work for Intel platforms with i386, i686, and so on.
-v, --verbose	Provide more verbose output
-vv	Provide even more verbose output, including debugging information
--version	Print the RPM version and exit

Appendix A

Chris Ricker

2003-01-28T14:36:00

Eric Foster-Johnson