RPM packages typically have file names like tree-1.5.2.2-4.fc13.x86_64.rpm
. The file name includes the package name (tree
), version (1.5.2.2
), release (4
), operating system major version (fc13
) and CPU architecture (x86_64
). Assuming the tree-1.5.2.2-4.fc13.x86_64.rpm
package is in the current directory, log in as root and type the following command at a shell prompt to install it:
rpm -ivh tree-1.5.2.2-4.fc13.x86_64.rpm
The -i
option tells rpm
to install the package, and the -v
and -h
options (which are combined with -i
) cause rpm to print more verbose output and display a progress meter using hash marks.
Alternatively, you can use the -U
option, which upgrades the package if an older version is already installed, or simply installs it if not:
rpm -Uvh tree-1.5.2.2-4.fc13.x86_64.rpm
If the installation is successful, the following output is displayed:
Preparing... ########################################### [100%]
1:tree ########################################### [100%]
As you can see, RPM prints out the name of the package and then prints a succession of hash marks as a progress meter while the package is installed.
The signature of a package is checked automatically when installing or upgrading a package. The signature confirms that the package was signed by an authorized party. For example, if the verification of the signature fails, an error message such as the following is displayed:
error: tree-1.5.2.2-4.fc13.x86_64.rpm: Header V3 RSA/SHA256 signature: BAD, key ID
d22e77f2
If it is a new, header-only, signature, an error message such as the following is displayed:
error: tree-1.5.2.2-4.fc13.x86_64.rpm: Header V3 RSA/SHA256 signature: BAD,
key ID d22e77f2
If you do not have the appropriate key installed to verify the signature, the message contains the word NOKEY
:
warning: tree-1.5.2.2-4.fc13.x86_64.rpm: Header V3 RSA/SHA1 signature: NOKEY, key ID 57bbccba
Warning
If you are installing a kernel package, you should always use the
rpm -ivh
command (simple install) instead of
rpm -Uvh
. The reason for this is that
install (
-i
) and
upgrade (
-U
) take on specific meanings when installing kernel packages. Refer to
Chapter 28, Manually Upgrading the Kernel for details.
3.2.2.1. Package Already Installed
If a package of the same name and version is already installed, the following output is displayed:
Preparing... ########################################### [100%]
package tree-1.5.2.2-4.fc13.x86_64 is already installed
However, if you want to install the package anyway, you can use the --replacepkgs
option, which tells RPM to ignore the error:
rpm -ivh --replacepkgs tree-1.5.2.2-4.fc13.x86_64.rpm
This option is helpful if files installed from the RPM were deleted or if you want the original configuration files from the RPM to be installed.
3.2.2.2. Conflicting Files
If you attempt to install a package that contains a file which has already been installed by another package, the following is displayed:
Preparing... ##################################################
file /usr/bin/foobar from install of foo-1.0-1.fc13 conflicts
with file from package bar-3.1.1.fc13
To make RPM ignore this error, use the --replacefiles
option:
rpm -ivh --replacefiles foo-1.0-1.fc13.x86_64.rpm
3.2.2.3. Unresolved Dependency
RPM packages may sometimes depend on other packages, which means that they require other packages to be installed to run properly. If you try to install a package which has an unresolved dependency, output similar to the following is displayed:
error: Failed dependencies:
bar.so.3()(64bit) is needed by foo-1.0-1.fc13.x86_64
Suggested resolutions:
bar-3.1.1.fc13.x86_64.rpm
If you are installing a package from the Fedora installation media, such as from a CD-ROM or DVD, it usually suggests the package or packages needed to resolve the dependency. Find the suggested package(s) on the Fedora installation media or on one of the active Fedora mirrors (
http://mirrors.fedoraproject.org/publiclist/) and add it to the command:
rpm -ivh foo-1.0-1.fc13.x86_64.rpm bar-3.1.1.fc13.x86_64.rpm
If installation of both packages is successful, output similar to the following is displayed:
Preparing... ########################################### [100%]
1:foo ########################################### [ 50%]
2:bar ########################################### [100%]
If it does not suggest a package to resolve the dependency, you can try the --whatprovides
option to determine which package contains the required file.
rpm -q --whatprovides "bar.so.3"
If the package that contains bar.so.3
is in the RPM database, the name of the package is displayed:
bar-3.1.1.fc13.i586.rpm
Warning: Forcing Package Installation
Although we can force rpm
to install a package that gives us a Failed dependencies
error (using the --nodeps
option), this is not recommended, and will usually result in the installed package failing to run. Installing or removing packages with rpm --nodeps
can cause applications to misbehave and/or crash, and can cause serious package management problems or, possibly, system failure. For these reasons, it is best to heed such warnings; the package manager—whether RPM, Yum or PackageKit—shows us these warnings and suggests possible fixes because accounting for dependencies is critical. The Yum package manager can perform dependency resolution and fetch dependencies from online repositories, making it safer, easier and smarter than forcing rpm
to carry out actions without regard to resolving dependencies.