Installing a Package

To install a package, log in as root and issue the following command from a shell prompt:

rpm -ivh package

In the command, package specifies the name of the file that contains the package.

Tip

Strictly speaking, it’s not necessary that you log in as root; however, your userid must be authorized to create and access the files and directories required by the package. Generally, the easiest way to ensure such access is by logging in as root.

The switches used in this command have the following meanings:

-i

This switch specifies that RPM should install the package or packages given as arguments.

-v

This switch, the verbose switch, specifies that RPM should print messages that summarize its actions and progress.

-h

This switch specifies that RPM should print hash marks (#) as it installs the package, as a visible indication of progress.

Generally, RPM will successfully install the specified package. However, several sorts of error can occur:

  • RPM may report that the package is already installed.

  • RPM may report that a package file conflicts with a file from another package.

  • RPM may report a failed dependency.

The next three sections explain how to resolve these errors.

Package Already Installed

If a package has already been installed, RPM will not overwrite the package without your permission:

# rpm -ivh bad-1.0-1.i386.rpm
bad package bad-1.0-1 is already installed

If you want to overwrite the package, add the --replacepkgs switch to your command:

rpm -ivh --replacepkgs package

Get Learning Red Hat Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.