The rpm command uses the RPM system to install, remove (erase), upgrade, verify, and build software archives known as RPM files. These archives, or packages, contain package identification (a signature), checksums (mathematically derived validation values), and an archive of the software, either in source or binary form. An RPM package also contains quite a bit of additional information, such as a name, version, and basic description, and can include pre- and post-installation scripts used for software installation, erasure, or upgrading.

What Is RPM?

RPM has a long history and is closely associated with Red Hat, the sponsors of Fedora. RPM itself can link itself back to early Linux package management software — named RPP PMS, and PM — that were written in Perl. RPM came onto the scene in Red Hat Linux 2.0, released late 1995, and was then rewritten in C for the Red Hat Linux 3.0.3 (Picasso) release in 1996. Since then, the rpm command has been the prime feature of Red Hat's unique software management system, which is based on the concept of pristine sources, or the capability to use a single, initial archive of a program's source code to build packages for different systems and to track versions.

In addition to improving the package management of early software management scripts, RPM version 4.1 introduced software features designed to ease the task of building software for different platforms from a single set of source-code files. Changes can be tracked and kept outside a developer's initial source code, and multiple packages can be built from scratch and installed at the same time. Simultaneously, RPM also verifies installation dependencies. Additional features, such as a checksum and GNU Privacy Guard (GPG) signatures, enable binary software pack ages to be safely distributed without the fear of virus infection or the inclusion of Trojan code. Red Hat has committed to further active development of RPM.

The RPM database installed on your computer keeps track of which versions of which packages are installed. RPM uses your system's /var/lib/rpm directory to store files (actually databases) containing information about the software installed on your system. You can use the ls command to view these files. (You might see file sizes different from those shown here, depending on the amount of software you have installed.)

total 75476

-rw-r--r-- 1 root  root 10432512 2007-10-29 21:36 Basenames

-rw-r--r-- 1 root  root    12288 2007-10-29 21:17 Conflictname

-rw-r--r-- 1 root  root        0 2007-10-29 21:17 __db.000

-rw-r--r-- 1 root  root    24576 2007-10-29 21:15 __db.001

-rw-r--r-- 1 root  root  1318912 2007-10-29 21:15 __db.002

-rw-r--r-- 1 root  root   450560 2007-10-29 21:15 __db.003

-rw-r--r-- 1 root  root  3145728 2007-10-29 21:36 Dirnames

-rw-r--r-- 1 root  root 10584064 2007-10-29 21:36 Filemd5s

-rw-r--r-- 1 root  root    32768 2007-10-29 21:36 Group

-rw-r--r-- 1 root  root    20480 2007-10-29 21:36 Installtid

-rw-r--r-- 1 root  root    86016 2007-10-29 21:36 Name

-rw-r--r-- 1 root  root 54706176 2007-10-29 21:36 Packages

-rw-r--r-- 1 root  root   344064 2007-10-29 21:36 Providename

-rw-r--r-- 1 root  root   131072 2007-10-29 21:36 Provideversion

-rw-r--r-- 1 root  root    12288 2007-10-29 21:17 Pubkeys

-rw-r--r-- 1 root  root   479232 2007-10-29 21:36 Requirename

-rw-r--r-- 1 root  root   278528 2007-10-29 21:36 Requireversion

-rw-r--r-- 1 root  root   163840 2007-10-29 21:36 Sha1header

-rw-r--r-- 1 root  root    81920 2007-10-29 21:36 Sigmd5

-rw-r--r-- 1 root  root    12288 2007-10-29 21:36 Triggername

The primary database of installed software is contained in the file named Packages. As you can see from the preceding example, this database can grow to 50MB (and perhaps larger) if you perform a full installation of Fedora (more than 4GB of software). After you install Fedora, rpm and related commands use this directory during software management operations.

rpm at the Command Line

As a Fedora system administrator, you will use the rpm command or the Fedora graphical clients to perform one of five basic tasks. These operations, which must be conducted by the root operator, include the following:

> Installing new software

> Erasing or removing outdated or unneeded packages

> Upgrading an installed software package

> Querying to get information about a software package

> Verifying the installation or integrity of a package installation

The rpm command has more than 60 command-line options, but its administrative functions can be grouped according to the previous five types of action. Graphical RPM clients provide easy-to-use interfaces to these operations. As a system administrator, you have a choice between using a graphical interface and using rpm's various command-line options.

The general format of an rpm command is as follows:

# rpm option packagename

The basic options look like this:

-i — Installs the selected package or packages

-e — Erases (removes) the selected package or packages

-U — Removes the currently installed package, and then installs software with the contents of the selected package or packages, leaving the existing configuration files

-q — Queries the system or selected package or packages

-V — Verifies installed or selected package or packages

Two Handy Options

By appending v or h to any option, you get the following:

v — Some status feedback

h — Hash marks as the work proceeds

Many additional options can also be added to or used in conjunction with these options. Table 34.1 summarizes these.

TABLE 34.1 Handy Options to Use with rpm

Option Used To
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату