rpm-guide rpm-guide-using-rpm-en.xml,NONE,1.1
Stuart Ellis (elliss)
fedora-docs-commits at redhat.com
Tue Oct 4 02:09:19 UTC 2005
Author: elliss
Update of /cvs/docs/rpm-guide
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2579
Added Files:
rpm-guide-using-rpm-en.xml
Log Message:
--- NEW FILE rpm-guide-using-rpm-en.xml ---
<!-- $Id: -->
<chapter id="ch-using-rpm">
<title>Using RPM</title>
<para>
Copyright (c) 2005 by Eric Foster-Johnson. This material may be
distributed only subject to the terms and conditions set forth in
the Open Publication License, v1.0 or later (the latest version is
presently available at http://www.opencontent.org/openpub/).
</para>
<para/>
<para>
In This Chapter
</para>
<para>
*Installing and upgrading software
</para>
<para>
*Removing software
</para>
<para>
This chapter covers the most common uses for RPM: installing,
removing, and upgrading software. These are the most frequently used
RPM commands.
</para>
<para>
The RPM system includes the options you might expect, such as
installing a package, but thereâs a lot more you can do. For
example, you can install packages from remote sites using HTTP or
FTP to download the package to install. There are quite a few other
rpm options you can use to get information and feedback on
installation, for example.
</para>
<sect1>
<title>The rpm Command</title>
<para>
Just about everything you do with RPM requires the rpm command. As
a nice added benefit, just about everything you do with RPM
requires a single invocation of the rpm command. That means common
tasks such as installing and removing software can be done quickly
and efficiently. The basics of the rpm command are not very hard,
and you can perform the basic tasks within a few minutes of
reading this chapter.
</para>
</sect1>
<sect1>
<title>Upgrading and Installing Software</title>
<para>
To install software, you need something to install. Typically,
this is a file packaged as RPM, using a file-name extension of
.rpm. Of course, this isnât required, but just about every RPM
package is stored in a file with a .rpm extension. For example,
the following file holds an RPM package, ready to be installed:
</para>
<para>
jikes-1.16-1.i386.rpm
</para>
<para>
This package holds an application named jikes (a Java language
compiler application). From the discussion in the last two
chapters, you should be able to determine the version of the
program this RPM holds and which release of the RPM package this
represents.
</para>
<para>
Other RPMs hold sources, the program source codes used to create
an application or programming library. For example, the following
file holds a source RPM:
</para>
<para>
jikes-1.16-1.src.rpm
</para>
<para>
The src in the package name is short for source. This file-naming
convention is not required, but is used by just about all source
code packages. (Following conventions helps other administrators
know what to expect.)
</para>
<para>
Cross Reference
</para>
<para>
Chapters 9 and 12 cover building RPMs from source RPMs.
</para>
<para>
The rpm command provides three main operations for upgrading and
installing packages:
</para>
<para>
An upgrade operation means installing a new version of a package
and removing all previous versions of the same package. If you
have not installed a package previously, the upgrade operation
will install the package.
</para>
<para>
A freshen operation means to install a new version of a package
only if you have already installed another version of the package.
</para>
<para>
An install operation installs a package for the first time. It
also, through special command-line parameters, allows you to
install multiple versions of a package, usually not what you want.
So, in the vast majority of cases, you want to run the upgrade
operation for all package installations.
</para>
<para>
The following sections cover the command-line options that apply
to these operations.
</para>
<sect2>
<title>Upgrading with the rpm command</title>
<para/>
<para>
Almost all installation steps use the rpm command with the âU
option, short for upgrade, as introduced in Chapter 3. The basic
syntax is:
</para>
<para>
rpm -U package_name
</para>
<para>
For example:
</para>
<para>
rpm âi jikes-1.16-1.i386.rpm
</para>
<para>
You can also use the --upgrade long option in place of -U.
</para>
<para>
Unless something goes wrong, you wonât see any response except
for the shell prompt ready for your next command. Options for
the rpm command, covered shortly, present positive feedback that
the package has been installed.
</para>
<para>
The rpm command may print out warnings, such as the one
following:
</para>
<para>
warning: pyxf86config-0.3.1-2.i386.rpm: Header V3 DSA
</para>
<para>
signature: NOKEY, key ID 897da07a
</para>
<para>
This warning comes from the fact that the package was signed,
but the key was not found. Chapter 12 covers signing packages.
In most cases, warnings such as this one are not that serious.
Errors, though, should be treated seriously.
</para>
<para>
Note
</para>
<para>
Just about every package you want to upgrade or install requires
root, or super user, permissions. Thatâs because most Linux
application RPMs hold files that must be installed in a
protected directory such as /usr/bin. In addition, RPM requires
root access to modify the RPM database. Even if you could modify
the system directories like /usr/bin, you must also be able to
modify the RPM database to successfully install or remove
packages.
</para>
<sect3>
<title>Checking That the Package Is Installed</title>
<para>
Use the rpm âq command to quickly verify a package has been
installed. To verify, you need to use the name of the
installed package, not the name of the RPM file. You can also
use a partial package name, such as jikes in this case. For
example:
</para>
<para>
rpm âq jikes
</para>
<para>
When you run this command, you should see a response like the
following:
</para>
<para>
jikes-1.16-1
</para>
<para>
The response shows that the package named jikes-1.16-1 has
been installed. This package name corresponds to the RPM file
used in the preceding installation example.
</para>
<para/>
<para>
The rpm -q command just asks the RPM database if the package
[...1758 lines suppressed...]
In most cases, the application looks in the user home directory
for a specific file tied to the application. For the rpm command,
this file is .rpmrc. The leading period makes the file hidden for
most directory listings.
</para>
<para>
In addition to the user-level file of commands, most applications
supporting this mechanism have a way for site administrators to
customize the command for all users. For example, your system may
have a file named /etc/rpmrc (with no leading period) that
customizes the rpm command for all users on your system. See page
427 for a more in-depth look at the chain of these files.
</para>
<para>
The syntax for the --rcfile option is
</para>
<para>
--rcfile filename
</para>
<para>
You can also supply more than one file name. This syntax follows:
</para>
<para>
--rcfile filename1:filename2:filename3
</para>
<para>
Separate each file name with a colon.
</para>
<para>
With Red Hat Linux, the default set of initialization files are:
</para>
<para>
/usr/lib/rpm/rpmrc:/usr/lib/rpm/redhat/rpmrc:/etc/rpmrc:~/.rpmrc
</para>
<para>
Note
</para>
<para>
The ~/.rpmrc means to look in the user's home directory for a file
named .rpmrc.
</para>
<para>
You can use the --showrc option to list all the rc settings.
</para>
<para>
Cross Reference
</para>
<para>
See Chapter 21 for more on the --showrc option.
</para>
<para>
The --version option tells the rpm command to print out the
version number of the command and then exit. For example:
</para>
<para>
rpm --version
</para>
<para>
This command prints out a version number, like the following:
</para>
<para>
RPM version 4.1
</para>
<para>
The --dbpath option, mentioned previously, tells the rpm command
to use a different RPM database. This is useful when testing a
complete system install, where you want to change the RPM database
but don't want that to affect your running Linux system. In this
case, you can use a different RPM database and test out your
changes. The basic syntax for this option is:
</para>
<para>
--dbpath directory_name
</para>
<para>
The --pipe option tells the rpm command to send, or pipe, its
output to another program. The syntax for this option is:
</para>
<para>
--pipe command_to_send_out_to
</para>
</sect1>
<sect1>
<title>Summary</title>
<para>
This chapter covered the easy part of managing packages, the
common actions of installing, removing, and upgrading software.
</para>
<para>
The rpm âe command removes packages. The rpm âU command
upgrades packages by installing new packages and removing old
versions of all the packages upgraded. RPM upgrades also work for
installing new packages. The rpm âF command freshens packages.
This command only upgrades a package if an older version of the
package has already been installed. The rpm âi command installs
packages.
</para>
<para>
Table 4-3 summarizes the rpm command-line options for installing,
removing, and upgrading packages.
</para>
<para>
Table 4-3 Installing, Removing, and Upgrading with the rpm command
</para>
<informaltable frame="all">
<tgroup cols="2">
<tbody>
<row>
<entry>
<para>
Command
</para>
</entry>
<entry>
<para>
Usage
</para>
</entry>
</row>
<row>
<entry>
<para>
rpm âi install_options package_files
</para>
</entry>
<entry>
<para>
Install packages.
</para>
</entry>
</row>
<row>
<entry>
<para>
rpm âe remove_options packages
</para>
</entry>
<entry>
<para>
Erase, remove, packages.
</para>
</entry>
</row>
<row>
<entry>
<para>
rpm âU install_options package_files
</para>
</entry>
<entry>
<para>
Upgrade or install packages. Use this option for
installations.
</para>
</entry>
</row>
<row>
<entry>
<para>
rpm âUvh install_options package_files
</para>
</entry>
<entry>
<para>
Upgrade or install packages with extra output. This is
the recommended command to install packages.
</para>
</entry>
</row>
<row>
<entry>
<para>
rpm âF install_options package_files
</para>
</entry>
<entry>
<para>
Freshen packages.
</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
Unfortunately, modern system management gets more complex than
that. The next chapter delves into package dependencies and the
nightmare you can get into when one package depends on another
that then depends on another, ad infinitum.
</para>
</sect1>
</chapter>
<!--
Local variables:
mode: xml
sgml-parent-document:("rpm-guide-en.xml" "book" "chapter")
fill-column: 72
End:
-->
More information about the Fedora-docs-commits
mailing list