📄 517-521.html
字号:
<HTML>
<HEAD>
<TITLE>Using Linux:Managing Applications</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!--ISBN=0789716232//-->
<!--TITLE=Using Linux//-->
<!--AUTHOR=William Ball//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Que//-->
<!--CHAPTER=30//-->
<!--PAGES=517-521//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="../ch29/513-517.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="521-524.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H2><A NAME="Heading1"></A><FONT COLOR="#000077">CHAPTER 30<BR>Managing Applications
</FONT></H2>
<P><I>By Sriranga Veeraraghaven</I></P>
<DL>
<DD>Managing Linux software packages with the <TT>rpm</TT> command
<DD>Installing, deleting, and upgrading software packages
<DD>Uninstalling software with the <TT>rpm</TT> command
<DD>Querying and verifying <TT>rpm</TT> packages
<DD>Using Red Hat’s <TT>glint</TT> X11 client for package management
<DD>Using the X11 <TT>xrpm</TT> client
</DL>
<H3><A NAME="Heading2"></A><FONT COLOR="#000077">Package Management with <I>rpm</I>
</FONT></H3>
<P>One of the most powerful and innovative utilities available in Red Hat Linux is <TT>rpm</TT>, the Red Hat package manager. It can be used to install, uninstall, upgrade, query, verify, and build software packages.</P>
<P>A software package build with <TT>rpm</TT> is an archive of files and some associated information, such as a name, a version, and a description. A few of the advantages of <TT>rpm</TT> packages over the traditional <TT>tar.gz</TT> method of software distribution are as follows:</P>
<DL>
<DD><B>•</B> Upgrading—A new version of the software can be installed without losing customization files.
<DD><B>•</B> Uninstalling—A software package that installs files in several locations can be cleanly removed.
<DD><B>•</B> Verification—After its installation, a package can be verified to be in working order.
<DD><B>•</B> Querying—Information about what package a file belongs to can be easily obtained.
</DL>
<P>In addition to these features, <TT>rpm</TT> is available for many flavors of Linux and UNIX, making it one of the emerging utilities for distributing software packages.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>SEE ALSO</B>
<DL>
<DD><B>•</B> To learn more about installing other Linux packages, see page 628.
<DD><B>•</B> For more information about other software backup or archiving utilities for Linux, see page 542.
</DL>
<HR></FONT>
</BLOCKQUOTE>
<H4 ALIGN="LEFT"><A NAME="Heading3"></A><FONT COLOR="#000077">The <I>rpm</I> Command’s Major Modes and Common Options
</FONT></H4>
<P>Following are the major modes in which <TT>rpm</TT> can be run:</P>
<DL>
<DD><B>•</B> Install (<TT>rpm -i</TT>)
<DD><B>•</B> Uninstall (<TT>rpm -e</TT>)
<DD><B>•</B> Query (<TT>rpm -q</TT>)
<DD><B>•</B> Verify (<TT>rpm -V</TT>)
</DL>
<P>The options to invoke the major modes are given in parentheses. These major modes are covered in detail in subsequent sections.
</P>
<P>All of these major modes understand the following options:</P>
<DL>
<DD><B>•</B> <TT>-vv</TT> Prints out all debugging information; this mode is useful for seeing what exactly RPM is doing.
<DD><B>•</B> <TT>--quiet</TT> Prints out very little information—only error messages.
</DL>
<P>In addition to these, there are a few other “minor” modes that are useful:
</P>
<DL>
<DD><B>•</B> <TT>version</TT> The <TT>version</TT> mode is invoked as the following:
<!-- CODE SNIP //-->
<PRE>
<B># rpm —version</B>
</PRE>
<!-- END CODE SNIP //-->
<BR>This mode prints out a line containing version information, similar to the following:
<!-- CODE SNIP //-->
<PRE>
RPM version 2.3.11
</PRE>
<!-- END CODE SNIP //-->
<DD><B>•</B> <TT>help</TT> The <TT>help</TT> mode prints out an extensive help message:
<!-- CODE SNIP //-->
<PRE>
<B># rpm —help</B>
</PRE>
<!-- END CODE SNIP //-->
<DD><B>•</B> <TT>showrc</TT> If a message is long, it is handy to have a large <TT>xterm</TT> to pipe the output to <TT>more</TT>. To get a shorter help message, just type the following:
<!-- CODE SNIP //-->
<PRE>
<B># rpm</B>
</PRE>
<!-- END CODE SNIP //-->
<BR>This prints out a usage message. The <TT>showrc</TT> mode prints out a list of variables that can be set in the files <TT>/etc/rpmrc</TT> and <TT>$HOME/.rpmrc</TT>:
<!-- CODE SNIP //-->
<PRE>
<B># rpm &3151;showrc</B>
</PRE>
<!-- END CODE SNIP //-->
<BR>The default values are adequate for most installations.
<DD><B>•</B> <TT>rebuilddb</TT> The <TT>rebuilddb</TT> option is used to rebuild the database that <TT>rpm</TT> uses to keep track of which packages are installed on a system. Although this option is rarely needed, it is invoked as follows:
<!-- CODE SNIP //-->
<PRE>
<B># rpm &3151;rebuilddb</B>
</PRE>
<!-- END CODE SNIP //-->
</DL>
<H4 ALIGN="LEFT"><A NAME="Heading4"></A><FONT COLOR="#000077">Installing Packages</FONT></H4>
<P>One of the major uses of <TT>rpm</TT> is to install software packages. The general syntax of an <TT>rpm</TT> install command is as follows:</P>
<!-- CODE SNIP //-->
<PRE>
rpm -i [options] [packages]
</PRE>
<!-- END CODE SNIP //-->
<P><TT><I>options</I></TT> can be one of the common options given earlier or one of the install options covered in the following list, and <TT><I>packages</I></TT> is the name of one or more <TT>rpm</TT> package files. Some of the install options are listed in Table 30.1.</P>
<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>TABLE 30.1</B> <I>rpm</I> install options
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TH WIDTH="25%" ALIGN="LEFT">Option
<TH WIDTH="75%" ALIGN="LEFT">Description
<TR>
<TD COLSPAN="2"><HR>
<TR>
<TD><TT>-v</TT>
<TD>Prints out what rpm is doing.
<TR>
<TD><TT>-h or --hash</TT>
<TD>Prints out 50 hash marks (<TT>#</TT>) as the package is installed.
<TR>
<TD VALIGN="TOP"><TT>--percent</TT>
<TD>Prints out percentages as files are extracted from the package.
<TR>
<TD VALIGN="TOP"><TT>--test</TT>
<TD>Goes through a package install, but does not install anything; mainly used to catch conflicts.
<TR>
<TD VALIGN="TOP"><TT>--excludedocs</TT>
<TD>Prevents the installation of files marked as documentation, such as man pages.
<TR>
<TD VALIGN="TOP"><TT>--includedocs</TT>
<TD>Forces files marked as documentation to be installed; this is the default.
<TR>
<TD VALIGN="TOP"><TT>--nodeps</TT>
<TD>No dependency checks are performed before installing a package.
<TR>
<TD VALIGN="TOP"><TT>--replacefiles</TT>
<TD>Allows for installed files to be replaced with files from the package being installed.
<TR>
<TD VALIGN="TOP"><TT>--replacepkgs</TT>
<TD>Allows for installed packages to be replaced with the packages being installed.
<TR>
<TD VALIGN="TOP"><TT>--oldpackage</TT>
<TD>Allows for a newer version of an installed package to be replaced with an older version.
<TR>
<TD><TT>--Force</TT>
<TD>Forces a package to be installed.
<TR>
<TD COLSPAN="2"><HR>
</TABLE>
<P>When giving options to <TT>rpm</TT>, regardless of the mode, all the single-letter options can be lumped together in one block:</P>
<!-- CODE SNIP //-->
<PRE>
<B># rpm -i -v -h kernel-2.0.30-3.i386.rpm</B>
</PRE>
<!-- END CODE SNIP //-->
<P>This command is equivalent to the following:
</P>
<!-- CODE SNIP //-->
<PRE>
<B># rpm -ivh kernel-2.0.30-3.i386.rpm</B>
</PRE>
<!-- END CODE SNIP //-->
<P>All options starting with <TT>--</TT> must be given separately, however.</P>
<P>Now take a look at a few examples of installing <TT>rpm</TT> packages. The first example installs <TT>vim</TT> (the improved version of <TT>vi</TT>) from the following package:</P>
<!-- CODE SNIP //-->
<PRE>
vim-4.5-2.i386.rpm
</PRE>
<!-- END CODE SNIP //-->
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="../ch29/513-517.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="521-524.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -