7.5.2.1.1. What is RPM?
RPM, the RedHat Package
Manager, is a powerful package manager that you can use to
install, update and remove packages. It allows you to search for
packages and keeps track of the files that come with each package.
A system is built-in so that you can verify the authenticity of
packages downloaded from the Internet. Advanced users can build
their own packages with RPM.
An RPM package consists of an archive of files and meta-data
used to install and erase the archive files. The meta-data includes
helper scripts, file attributes, and descriptive information about
the package. Packages come in two varieties: binary packages, used
to encapsulate software to be installed, and source packages,
containing the source code and recipe necessary to produce binary
packages.
Many other distributions support RPM packages, among the popular
ones RedHat Enterprise Linux, Mandriva (former Mandrake), Fedora
Core and SuSE Linux. Apart from the advice for your distribution,
you will want to read man rpm.
7.5.2.1.2. RPM examples
Most packages are simply installed with the upgrade option,
-U, whether the package is already
installed or not. The RPM package contains a complete version of
the program, which overwrites existing versions or installs as a
new package. The typical usage is as follows:
rpm -Uvh /path/to/rpm-package(s)
The -v option generates more verbose
output, and -h makes rpm print a progress bar:
[root@jupiter tmp]# rpm -Uvh totem-0.99.5-1.fr.i386.rpm
Preparing... ########################################### [100%]
1:totem ########################################### [100%]
[root@jupiter tmp]#
|
New kernel packages, however, are installed with the install
option -i, which does not overwrite
existing version(s) of the package. That way, you will still be
able to boot your system with the old kernel if the new one does
not work.
You can also use rpm to check whether a
package is installed on your system:
[david@jupiter ~] rpm -qa | grep vim
vim-minimal-6.1-29
vim-X11-6.1-29
vim-enhanced-6.1-29
vim-common-6.1-29
|
Or you can find out which package contains a certain file or
executable:
[david@jupiter ~] rpm -qf /etc/profile
setup-2.5.25-1
[david@jupiter ~] which cat
cat is /bin/cat
[david@jupiter ~] rpm -qf /bin/cat
coreutils-4.5.3-19
|
Note that you need not have access to administrative privileges
in order to use rpm to query the RPM
database. You only need to be root when adding, modifying
or deleting packages.
Below is one last example, demonstrating how to uninstall a
package using rpm:
[root@jupiter root]# rpm -e totem
[root@jupiter root]#
|
Note that uninstalling is not that verbose by default, it is
normal that you don't see much happening. When in doubt, use
rpm -qa again to
verify that the package has been removed.
RPM can do much more than the couple of basic functions we
discussed in this introduction; the
RPM HOWTO contains further references.