Наши партнеры








Книги по Linux (с отзывами читателей)

Библиотека сайта rus-linux.net

Chapter 2. Using RPM to Install Packages

Table 2-1. rpm -i Command Syntax

rpm -i (or --install) options file1.rpmfileN.rpm
Parameters
file1.rpmfileN.rpm One or more RPM package files (URLs OK)
Install-specific Options Page
-h (or --hash) Print hash marks ("#") during install the section called -h: Perfect for the Impatient
--test Perform installation tests only the section called --test: Perform Installation Tests Only
--percent Print percentages during install the section called --percent: Not Meant for Human Consumption
--excludedocs Do not install documentation the section called --excludedocs: Do Not Install Documentation For This Package
--includedocs Install documentation the section called --includedocs: Install Documentation For This Package
--replacepkgs Replace a package with a new copy of itself the section called --replacepkgs: Install the Package Even If Already Installed
--replacefiles Replace files owned by another package the section called --replacefiles: Install the Package Even If It Replaces Another Package's Files
--force Ignore package and file conflicts the section called --force: The Big Hammer
--noscripts Do not execute pre- and post-install scripts the section called --noscripts: Do Not Execute Pre- and Post-install Scripts
--prefix <path> Relocate package to <path> if possible the section called --prefix <path>: Relocate the package to <path>, if possible
--ignorearch Do not verify package architecture the section called --ignorearch: Do Not Verify Package Architecture
--ignoreos Do not verify package operating system the section called --ignoreos: Do Not Verify Package Operating System
--nodeps Do not check dependencies the section called --nodeps: Do Not Check Dependencies Before Installing Package
--ftpproxy <host> Use <host> as the FTP proxy the section called --ftpproxy <host>: Use <host> As Proxy In FTP-based Installs
--ftpport <port> Use <port> as the FTP port the section called --ftpport <port>: Use <port> In FTP-based Installs
General Options Page
-v Display additional information the section called Getting a bit more feedback with -v
-vv Display debugging information the section called Getting a lot more information with -vv
--root <path> Set alternate root to <path> the section called --root <path>: Use <path> As An Alternate Root
--rcfile <rcfile> Set alternate rpmrc file to <rcfile> the section called --rcfile <rcfile>: Use <rcfile> As An Alternate rpmrc File
--dbpath <path> Use <path> to find the RPM database the section called --dbpath <path>: Use <path> To Find RPM Database

rpm -i — What does it do?

Of the many things RPM can do, probably the one that people think of first is the installation of software. As mentioned earlier, installing new software is a complex, error-prone job. RPM turns that process into a single command.

rpm -i (--install is equivalent) installs software that's been packaged into an RPM package file. It does this by:

  • Performing dependency checks.

  • Checking for conflicts.

  • Performing any tasks required before the install.

  • Deciding what to do with config files.

  • Unpacking files from the package and putting them in the proper place.

  • Performing any tasks required after the install.

  • Keeping track of what it did.

Let's go through each of these steps in a bit more detail.

Performing dependency checks:

Some packages will not operate properly unless some other package is installed, too. RPM makes sure that the package being installed will have its dependency requirements met. It will also insure that the package's installation will not cause dependency problems for other already-installed packages.

Checking for conflicts:

RPM performs a number of checks during this phase. These checks look for things like attempts to install an already installed package, attempts to install an older package over a newer version, or the possibility that a file may be overwritten.

Performing any tasks required before the install:

There are cases where one or more commands must be given prior to the actual installation of a package. RPM performs these commands exactly as directed by the package builder, thus eliminating a common source of problems during installations.

Deciding what to do with config files:

One of the features that really sets RPM apart from other package managers, is the way it handles configuration files. Since these files are normally changed to customize the behavior of installed software, simply overwriting a config file would tend to make people angry — all their customizations would be gone! Instead, RPM analyzes the situation and attempts to do "the right thing" with config files, even if they weren't originally installed by RPM! [1]

Unpacking files from the package and putting them in the proper place:

This is the step most people think of when they think about installing software. Each package file contains a list of files that are to be installed, as well as their destination on your system. In addition, many other file attributes, such as permissions and ownerships, are set correctly by RPM.

Performing any tasks required after the install:

Very often a new package requires that one or more commands be executed after the new files are in place. An example of this would be running ldconfig to make new shared libraries accessible.

Keeping track of what it did:

Every time RPM installs a package on your system, it keeps track of the files it installed, in its database. The database contains a wealth of information necessary for RPM to do its job. For example, RPM uses the database when it checks for possible conflicts during an install.

Notes

[1]

Are you interested in what exactly "the right thing" means? the section called Config file magic in Chapter 4 has all the details.