Product SiteDocumentation Site

Chapter 21. RPM Command Reference

21.1. The rpm Command
21.1.1. Upgrade, freshen, and install options
21.1.2. Erase options
21.1.3. Signature options
21.1.4. Verify options
21.1.5. Database options
21.1.6. Miscellaneous options
21.2. The rpmbuild Command
21.2.1. Building from a spec file
21.2.2. Building from a compressed tar archive
21.2.3. Rebuilding RPMs from source RPMs
21.2.4. Customizing the build
This appendix covers:
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