0101-0104.html
来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 310 行
HTML
310 行
<HTML>
<HEAD>
<TITLE>Maximum RPM (RPM):Miscellanea:EarthWeb Inc.-</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=0672311054 //-->
<!-- TITLE=Maximum RPM (RPM)//-->
<!-- AUTHOR=Edward Bailey//-->
<!-- PUBLISHER=Macmillan Computer Publishing//-->
<!-- IMPRINT=Sams//-->
<!-- CHAPTER=08 //-->
<!-- PAGES=0101-0110 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="../ch07/0100-0100.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0105-0107.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-101"><P>Page 101</P></A>
<H3><A NAME="ch08_ 1">
Chapter 8
</A></H3>
<H2>
Miscellanea
</H2>
<A NAME="PAGENUM-102"><P>Page 102</P></A>
<P>As with any other large, complex subject, there are always some leftovers—things that just
don't seem to fit in any one category. RPM is no exception. This chapter covers those aspects of
RPM that can only be called "miscellanea."
</P>
<H3><A NAME="ch08_ 2">
8.1. Other RPM Options
</A></H3>
<P>The options described in the following sections normally are not used on a day-to-day
basis. However, some of them can be quite important when the need arises. One such option is <BR>
--rebuilddb.
</P>
<H4><A NAME="ch08_ 3">
8.1.1. --rebuilddb: Rebuild RPM Database
</A></H4>
<P>We all hope the day never comes, and for many of us, it never does. But still, there is a
chance that one day, while you're busy using RPM to install or upgrade a package, you'll see this message:
</P>
<!-- CODE SNIP //-->
<PRE>
free list corrupt (42)- contact rpm-list@redhat.com
</PRE>
<!-- END CODE SNIP //-->
<P>When this happens, you'll find there's very little that you can do, RPM-wise. However,
before you fire off an e-mail to the RPM mailing list, you might try the
--rebuilddb option. The format of the command is simple:
</P>
<!-- CODE SNIP //-->
<PRE>
rpm --rebuilddb
</PRE>
<!-- END CODE SNIP //-->
<P>The command produces no output. After a few minutes, it completes with nary a peep.
Here's an example of --rebuilddb being used on an RPM database that wasn't corrupt. First,
let's look at the files that comprise the database:
</P>
<!-- CODE //-->
<PRE>
# cd /var/lib/rpm
# ls
total 3534
-rw-r--r-- 1 root root 1351680 Oct 17 10:35 fileindex.rpm
-rw-r--r-- 1 root root 16384 Oct 17 10:35 groupindex.rpm
-rw-r--r-- 1 root root 16384 Oct 17 10:35 nameindex.rpm
-rw-r--r-- 1 root root 2342536 Oct 17 10:35 packages.rpm
-rw-r--r-- 1 root root 16384 Oct 17 10:35 providesindex.rpm
-rw-r--r-- 1 root root 16384 Oct 17 10:35 requiredby.rpm
#
</PRE>
<!-- END CODE //-->
<P>Then, issue the command:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm --rebuilddb
#
</PRE>
<!-- END CODE SNIP //-->
<P>After a few minutes, the command completes, and we take a look at the files again:
</P>
<!-- CODE //-->
<PRE>
# ls
total 3531
-rw-r--r-- 1 root root 1351680 Oct 17 20:50 fileindex.rpm
-rw-r--r-- 1 root root 16384 Oct 17 20:50 groupindex.rpm
-rw-r--r-- 1 root root 16384 Oct 17 20:50 nameindex.rpm
-rw-r--r-- 1 root root 2339080 Oct 17 20:50 packages.rpm
</PRE>
<!-- END CODE //-->
<A NAME="PAGENUM-103"><P>Page 103</P></A>
<!-- CODE SNIP //-->
<PRE>
-rw-r--r-- 1 root root 16384 Oct 17 20:50 providesindex.rpm
-rw-r--r-- 1 root root 16384 Oct 17 20:50 requiredby.rpm
#
</PRE>
<!-- END CODE SNIP //-->
<P>You'll note that packages.rpm decreased in size. This is due to a side-effect of the
--rebuilddb option. While it is going through the database, it is getting rid of unused portions of the
database. Our example was performed on a newly installed system where only one or two
packages had been upgraded, so the reduction in size was small. For a system that has been through
a complete upgrade, the difference would be more dramatic.
</P>
<P>Does this mean that you should rebuild the database every once in a while? Not
necessarily. Since RPM eventually will make use of the holes, there's no major advantage to regular
rebuilds. However, when an RPM-based system has undergone a major upgrade, it
certainly wouldn't hurt to spend a few minutes using
--rebuilddb to clean things up.
</P>
<H4><A NAME="ch08_ 4">
8.1.2. --initdb: Create a New RPM Database
</A></H4>
<P>If you are already using RPM, the --initdb option is one you'll probably never have to
use. The --initdb option is used to create a new RPM database. That's why you'll probably
not need it if you're already using RPM: You already have an RPM database.
</P>
<P>It might seem that the --initdb option would be dangerous. After all, won't it trash your
current database if you mistakenly use it? Fortunately, the answer is no. If there is an RPM
database in place already, it's still perfectly safe to use the option, even though it won't
accomplish much. As an example, here's a listing of the files that make up the RPM database on a Red
Hat Linux system:
</P>
<!-- CODE //-->
<PRE>
# ls /var/lib/rpm
total 3559
-rw-r--r-- 1 root root 16384 Jan 8 22:10 conflictsindex.rpm
-rw-r--r-- 1 root root 1351680 Jan 8 22:10 fileindex.rpm
-rw-r--r-- 1 root root 16384 Jan 8 22:10 groupindex.rpm
-rw-r--r-- 1 root root 16384 Jan 8 22:10 nameindex.rpm
-rw-r--r-- 1 root root 2349640 Jan 8 22:10 packages.rpm
-rw-r--r-- 1 root root 16384 Jan 8 22:10 providesindex.rpm
-rw-r--r-- 1 root root 16384 Jan 8 22:10 requiredby.rpm
#
</PRE>
<!-- END CODE //-->
<P>Next, let's use the --initdb option, just to see what it does to this database:
</P>
<!-- CODE //-->
<PRE># rpm --initdb
# ls /var/lib/rpm
total 3559
-rw-r--r-- 1 root root 16384 Jan 8 22:10 conflictsindex.rpm
-rw-r--r-- 1 root root 1351680 Jan 8 22:10 fileindex.rpm
-rw-r--r-- 1 root root 16384 Jan 8 22:10 groupindex.rpm
-rw-r--r-- 1 root root 16384 Jan 8 22:10 nameindex.rpm
-rw-r--r-- 1 root root 2349640 Jan 8 22:10 packages.rpm
-rw-r--r-- 1 root root 16384 Jan 8 22:10 providesindex.rpm
-rw-r--r-- 1 root root 16384 Jan 8 22:10 requiredby.rpm
#
</PRE>
<!-- END CODE //-->
<A NAME="PAGENUM-104"><P>Page 104</P></A>
<P>Since an RPM database existed already, the
--initdb option did no harm to it—there was
no change to the database files.
</P>
<P>The only other option that can be used with
--initdb is --dbpath. This permits the easy creation of a new RPM database in the directory specified with the
--dbpath option.
</P>
<H4><A NAME="ch08_ 5">
8.1.3. --quiet: Produce As Little Output As Possible
</A></H4>
<P>Adding the --quiet option to any RPM command directs RPM to produce as little output
as possible. For example, RPM's build command (the subject of Part II, "RPM and
Developers: How to Distribute Your Software More Easily with RPM") normally produces reams of
output; by adding the --quiet option, this is all you'll see:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -ba --quiet bother-3.5.spec
Package: bother
1 block
3 blocks
#
</PRE>
<!-- END CODE SNIP //-->
<P>The --quiet option can silence even the mighty
-vv option:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -Uvv --quiet eject-1.2-2.i386.rpm
#
</PRE>
<!-- END CODE SNIP //-->
<H4><A NAME="ch08_ 6">
8.1.4. --help: Display a Help Message
</A></H4>
<P>RPM includes a concise built-in help message for those times when you need a reminder
about a particular command. Normally, you'll want to use the
--help option by itself, although you might want to pipe the output through a pager such as
less, since the output is more than one screen long:
</P>
<!-- CODE //-->
<PRE>
# rpm --help|less
RPM version 2.3
Copyright (C) 1995 - Red Hat Software
This may be freely redistributed under the terms of the GNU Public License
usage:
--help - print this message
--version - print the version of rpm being used
all modes support the following arguments:
--rcfile <file> - use <file> instead of /etc/rpmrc and $HOME/.rpmrc
-v - be a little more verbose
-vv - be incredibly verbose (for debugging)
-q - query mode
--root <dir> - use <dir> as the top level directory
--dbpath <dir> - use <dir> as the directory for the database
--queryformat <s> - use s as the header format (implies -i)
install, upgrade and query (with -p) allow ftp URL's to be used in place of
file names as well as the following options:
--ftpproxy <host> - hostname or IP of ftp proxy
--ftpport <port> - port number of ftp server (or proxy)
</PRE>
<!-- END CODE //-->
<P><CENTER>
<a href="../ch07/0100-0100.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0105-0107.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?