Here are my most commonly used RPM commands.
See more sections on Gnu/Linux .
RPM is a handy way to ship and install code for most linux distributions. See an excellent introduction at http://www-106.ibm.com/developerworks/library/l-rpm1/ and many referencees at http://www.rpm.org/
First look for rpms on your installation disks.
If you are installing from Redhat or Fedora
you can find and install packages with
yum
. These will download
rpm's appropriate for your distribution, then
install or upgrade.
Not every rpm is assembled correctly. If you
cannot find an rpm for your distribution,
then download and compile the source code.
Source rpms are available that install only
source code under /usr/src
.
The CD's that install RedHat and Mandrake
come with large directories of rpms. If I
have a large disk drive, then I copy iso
images of the CDs to a directory under
/usr/src.
You can then read the disk
image by mounting it as a file system:
mount -o loop -t iso9660 imagefile.iso imagedir |
Most CD installs come with a directory of
rpm
files for additional features. (Look
in /mnt/cdrom
.) Install as root, with
the single command
rpm -Uvh psutils-1.17-5.i386.rpm |
You will be told if you need to install other
software first. (Using -U
instead of
-i
will replace previous versions.) You
can test dependencies without installing, and
without becoming root, by adding the
--test
flag:
rpm -Uvh --test xsane-0.77-4.i386.rpm error: failed dependencies: sane-backends >= 1.0.5-3 is needed by xsane-0.77-4 libsane.so.1 is needed by xsane-0.77-4 |
Include all dependencies in a single install command:
rpm -Uvh --test xsane-0.77-4.i386.rpm sane-backends-1.0.5-4.i386.rpm Preparing... ########################################### [100%] |
See what files will be installed by an rpm with
rpm -qlp psutils-1.17-5.i386.rpm or less psutils-1.17-5.i386.rpm |
less
nicely formats the contents and
descriptive information inside an rpm.
See what rpm package and version was used to install a file by
rpm -qf /usr/bin/latex2html tetex-latex-1.0.7-30 |
See dependencies with
rpm -qRf /usr/bin/latex2html or rpm -qR tetex-latex-1.0.7-30 |
See what other files were installed by the package with
rpm -qlf /usr/bin/latex2html or rpm -ql tetex-latex-1.0.7-30 |
List all installed packages with
rpm -qa | sort |
If you do not want to install in public
system directories, specify an alternative
like --prefix /my/usr/local/
.
To uninstall, use the --erase
option, and
test first.
If you download the entire updates directory for your distribution, then you can upgrade all packages you have installed without installing anything new:
rpm -Fvh *.rpm |
Rpm updates have been known to hang because a
previous one was killed and left a lock file
behind. Delete the lock files with rm -f
/var/lib/rpm/__*
See if you have accidentally deleted any dependencies with
rpm -Va |
Verify a particular program with
rpm -Vf /usr/bin/program |
Extract all rpm files locally with
cat src.rpm | rpm2cpio | pax -r |
Bill Harlan, 2004
Return to parent directory.