See also RPM-HOWTO document.
In its simplest form, RPM can be used to install, erase or upgrade packages:
bash# rpm -i foobar-1.0-1.i386.rpm ...(to install packages) bash# rpm -i ftp://ftp.redhat.com/pub/redhat/RPMS/foo-1.0-1.i386.rpm ...(to install package via ftp) bash# rpm -e foobar ...(to uninstall package) bash# rpm -U foobar-1.0-1.i386.rpm ...(to upgrade package) bash# rpm --help ...(to see help on rpm options) bash# man rpm ...(to read online manual page)
To build rpm packages
bash# rpm -i foobar*.src.rpm bash# cd /usr/src/redhat/SPECS bash# rpm -ba foobar-1.0-1.spec To build in incremental steps, do: bash# rpm -bp foobar-1.0-1.spec ...( to do prep stage) bash# rpm --short-circuit -bc foobar-1.0-1.spec ...( to do build stage) bash# rpm --short-circuit -bi foobar-1.0-1.spec ...( to do install stage) bash# rpm -ba foobar-1.0-1.spec ... (to do binary and source package)
You can query the rpm database with these powerful commands:
bash$ rpm -qpl foobar-1.0-1.i386.rpm ....(list of files in a rpm package) bash$ rpm -ql foobar-1.0-1 ....(list of files from already installed package) bash$ rpm -qpR foobar-1.0-1.i386.rpm ....(list packages on which this package depends) bash$ rpm -qR foobar-1.0-1 ....(list packages on which this installed package depends) bash$ # rpm -q foo ...(print package name, version, and release number of package foo) foo-2.0-1 bash$ rpm -qa | less ....(list all the installed package) bash$ rpm -qa | grep -i kde ....(list all the installed package matching kde) bash$ rpm -qif /bin/ls ....(list the package which installed the file /bin/ls) To show the values RPM will use for all of the options that may be set in rpmrc files (/usr/lib/rpm/rpmrc, /etc/rpmrc, ~/.rpmrc ), type: bash$ rpm --showrc | less
Verifying a package compares information about files installed from a package with the same information from the original package. Among other things, verifying compares the size, MD5 sum, permissions, type, owner and group of each file.
The command rpm -V verifies a package. You can use any of the Package Selection Options listed for querying to specify the packages you wish to verify. A simple use is rpm -V foo which verifies that all the files in the foo package are as they were when they were originally installed. For example:
bash$ rpm -Vf /bin/vi ...(To verify a package containing particular file) bash$ rpm -Va ...(To verify ALL installed packages) bash$ rpm -Vp foo-1.0-1.i386.rpm ...(To verify an installed package against an RPM package file)
If everything verified properly there will be no output. If there are any discrepancies they will be displayed. 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 checksum S -- File size L -- Symbolic link T -- File modification time D -- Device U -- User G -- Group M -- Mode (includes permissions and file type) ? -- Unreadable file