In its simplest form, RPM can be used to install packages:
rpm -i foobar-1.0-1.i386.rpm
The next simplest command is to uninstall a package:
rpm -u foobar
One of the more complex but highly useful commands allows you to install packages via FTP. If you are connected to the net and want to install a new package, all you need to do is specify the file with a valid URL, like so:
rpm -i ftp://ftp.pht.com/pub/linux/redhat/rh-2.0-beta/RPMS/foobar-1.0-1.i386.rpm
Please note, however, that the current version of RPM will only do installs via FTP. You cannot run any of the more complex query options on packages at an FTP site.
While these are simple commands, rpm can be used in a multitude
of ways as seen from the Usage
message:
rpm version 1.0
Copyright (C) 1995 - Red Hat Software
This may be freely redistributed under the terms of the GNU Public License
Usage:
--help - print this message
-q - query mode
Package specification options:
-a - query all packages
-f <file>+ - query package owning <file>
-F - like -f, but read file names from stdin
-p <packagefile>+ - query (uninstalled) package <packagefile>
-P - like -f, but read package names from stdin
Information selection options:
-i - display package information
-l - display package file list
-s - show file states (implies -l)
-d - list only documentation files (implies -l)
-c - list only configuration files (implies -l)
-V
-y
--verify - verify a package installation
same package specification options as -q
--install <packagefile>
-i <packagefile> - install package
-v - be a little verbose
-h
--hash - print hash marks as package installs (good with -v)
--percent - print percentages as package installs
--force - install despite potential conflicts
--test - don't install, but tell if it would work or not
--upgrade <packagefile>
-U <packagefile> - upgrade package (same options as --install)
--uninstall <package>
-u <package> - uninstall package
-b<stage> <spec> - build package, where <stage> is one of:
p - prep (unpack sources and apply patches)
l - list check (do some cursory checks on %files)
c - compile (prep and compile)
i - install (prep, compile, install)
b - binary package (prep, compile, install, package)
a - bin/src package (prep, compile, install, package)
--short-circuit - skip straight to specified stage (only for c,i)
--clean - remove build tree when done
--keep-temps - do not delete scripts (or any temp files) in /tmp
--test - do not execute any stages, implies --keep-temps
in /tmp - useful for testing
--time-check <s> - set the time check to S seconds (0 disables it)
First, I'll go through a synopsis of what all the options mean (don't worry, there may be alot of options, but we tried to make them all as intuitive as possible).
Options are nested, so the possible options are many. Here's a description
in parallel with the Usage
message:
help
prints the usage message-q
is the query option. In its simplest form, you can
do rpm -q foobar
which would return foobar-1.0-1
. (1.0 is
the version number, 1 is the release number.)-q
:
-a
will query all currently installed packages.-f <file>
will query the package
owning <file>.-F
is the same as -f
except you can give it
filenames via stdin (ie. ls /usr/bin | rpm -qF
).-p <packagefile>
will query the package.
It is really only useful when combined with one of the Information
Selection Options below.-P
is like -p, except it takes its package filenames
from stdin (ie. ls /mnt/redhat/redhat-2.0/RPMS | rpm -qP
).-i
displays package information such as Name,
Description, Release, etc.-l
will display the file list from the entire
package (all files that get installed). You can also use a -v
with
this to make the file list much more verbose.-s
shows you the state of all the files in the package. There
are only two possible states, normal and missing.-d
outputs a list of just the files marked as
documentation (man pages, info pages, README's, etc). -v
will give
even more info.-c
outputs a list of only the configuration
files (sendmail.cf, passwd, inittab, etc.) -v
will give more info
about the files.{-V,-y,--verify}
are the verify options. All are interchangeable.
They all take the same Package Specification and Information Selection
options as the -q
option. I'll list some examples:
rpm -yf /bin/vi
rpm -ya
rpm -Vp foobar-1.0-1.rpm
--install
installs an rpm file.-i
installs an rpm file.
--hash, -h
is a very cool option for watching the package
install (much like 'hash' in ftp).--percent
prints the percentages as a package installs (but is
only useful for interfacing with other tools...is not really human
readable).--force
will force an install of a binary package even
though it may already exist in the database.--test
will tell you if installing would work or not (do you
have a conflict with an already installed package).-U
upgrades a package. This option installs the new package and
then uninstalls the old one without hurting the new one...-v
be verbose in the output of what's going on.-vv
be very verbose in the output of what's going on.--uninstall, -u <package>
to uninstall a package-b
to build a package (from sources and a spec file).
This option will be discussed more at length in the next section,
Building RPMs.Next Chapter, Previous Chapter
Table of contents of this chapter, General table of contents
Top of the document, Beginning of this Chapter