⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 524-528.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 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=524-528//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="521-524.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="528-533.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<P>This means that the package <TT>xdosemu</TT> does not function properly if the package <TT>dosemu</TT> is removed. If you still want to remove this package, <TT>rpm</TT> could be presented with the <TT>--nodeps</TT> option to make it ignore dependency errors.</P>

<P>The other useful option is the <TT>--test</TT> option, which causes <TT>rpm</TT> to go through the motions of removing a package without actually removing anything. Usually there is no output from an uninstall, so the <TT>-vv</TT> option is presented along with the <TT>--test</TT> option to see what would happen during an uninstall:</P>

<!-- CODE SNIP //-->

<PRE>

<B># rpm -e -vv --test xdosemu</B>

</PRE>

<!-- END CODE SNIP //-->

<P>This example produces the following output on the system:

</P>

<!-- CODE //-->

<PRE>

D: counting packages to uninstall

D: opening database in //var/lib/rpm/

D: found 1 packages to uninstall

D: uninstalling record number 1650520

D: running preuninstall script (if any)

D: would remove files test = 1

D: /usr/man/man1/xtermdos.1 - would remove

D: /usr/man/man1/xdos.1 - would remove

D: /usr/bin/xtermdos - would remove

D: /usr/bin/xdos - would remove

D: /usr/X11R6/lib/X11/fonts/misc/vga.pcf - would remove

D: running postuninstall script (if any)

D: script found - running from file /tmp/02695aaa

&#43; PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin

&#43; export PATH

&#43; [ -x /usr/X11R6/bin/mkfontdir ]

&#43; cd /usr/X11R6/lib/X11/fonts/misc

&#43; /usr/X11R6/bin/mkfontdir

D: would remove database entry

</PRE>

<!-- END CODE //-->

<P>As you can see, the files that would have been removed are clearly indicated in the output.

</P>

<H4 ALIGN="LEFT"><A NAME="Heading7"></A><FONT COLOR="#000077">Querying Packages</FONT></H4>

<P>The querying mode in <TT>rpm</TT> allows for determining the various attributes of packages. The basic syntax for querying packages is as follows:</P>

<!-- CODE SNIP //-->

<PRE>

rpm -q [options] [packages]

</PRE>

<!-- END CODE SNIP //-->

<P><TT><I>options</I></TT> is one or more of the query options listed later in this section. The most basic query is one similar to the following:</P>

<!-- CODE SNIP //-->

<PRE>

<B># rpm -q kernel</B>

</PRE>

<!-- END CODE SNIP //-->

<P>On my system, this prints out the following line for the kernel package:

</P>

<!-- CODE SNIP //-->

<PRE>

kernel-2.0.27-5

</PRE>

<!-- END CODE SNIP //-->

<P>In a manner similar to uninstall, <TT>rpm</TT>&#146;s query mode uses the name of the package, not the name of the file that the package came in for queries.</P>

<P>Now for a few more sample queries. If you want to retrieve a list of all the files &#147;owned&#148; by the kernel package, you can use the <TT>-l</TT> option:</P>

<!-- CODE SNIP //-->

<PRE>

<B># rpm -ql kernel</B>

</PRE>

<!-- END CODE SNIP //-->

<P>This outputs the following list of files on my system:

</P>

<!-- CODE SNIP //-->

<PRE>

/boot/System.map-2.0.27

/boot/module-info

/boot/vmlinuz-2.0.27

</PRE>

<!-- END CODE SNIP //-->

<P>In addition to getting a list of the files, you can determine their state by using the <TT>-s</TT> option:</P>

<!-- CODE SNIP //-->

<PRE>

<B># rpm -qs kernel</B>

</PRE>

<!-- END CODE SNIP //-->

<P>This option gives the following information about the state of files in my kernel package:

</P>

<!-- CODE SNIP //-->

<PRE>

normal        /boot/System.map-2.0.27

normal        /boot/module-infonormal        /boot/vmlinuz-2.0.27

</PRE>

<!-- END CODE SNIP //-->

<P>If any of these files reported a state of <TT>missing</TT>, there are probably problems with the package.</P>

<P>In addition to the state of the files in a package, the documentation files and the configuration files can be listed. To list the documentation that comes with the <TT>dosemu</TT> package, use the following:</P>

<!-- CODE SNIP //-->

<PRE>

<B># rpm -qd dosemu</B>

</PRE>

<!-- END CODE SNIP //-->

<P>This produces the following list:

</P>

<!-- CODE SNIP //-->

<PRE>

/usr/man/man1/dos.1

</PRE>

<!-- END CODE SNIP //-->

<P>To get the configuration files for the same package, use the following query:

</P>

<!-- CODE SNIP //-->

<PRE>

<B># rpm -qc dosemu</B>

</PRE>

<!-- END CODE SNIP //-->

<P>This results in the following list:

</P>

<!-- CODE SNIP //-->

<PRE>

/etc/dosemu.conf

/var/lib/dosemu/hdimage

</PRE>

<!-- END CODE SNIP //-->

<P>In addition to these queries, complete information about a package can be determined by using the <TT>info</TT> option:</P>

<!-- CODE SNIP //-->

<PRE>

<B># rpm -qi kernel</B>

</PRE>

<!-- END CODE SNIP //-->

<P>This example gives the following information about the installed kernel package:

</P>

<!-- CODE //-->

<PRE>

Name        : kernel            Distribution: Red Hat Linux Vanderbilt

Version     : 2.0.27            Vendor: Red Hat Software

Release     : 5                 Build Date: Sat Dec 21 21:06:28 1996

Install date: Thu Jul 17 14:10:52 1997    Build Host: porky.redhat.com

Group       : Base/Kernel       Source RPM: kernel-2.0.27-5.src.rpm

Size        : 565900

Summary     : Generic linux kernel

Description : This package contains the Linux kernel that is used

to boot and run your system. It contains few device drivers for

specific hardware. Most hardware is instead supported by modules

loaded after booting.

</PRE>

<!-- END CODE //-->

<P>A summary of the query options appears in Table 30.2.

</P>

<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>TABLE 30.2</B> Summary of <I>rpm</I>&#146;s query 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>-a</TT>

<TD>Lists all installed packages

<TR>

<TD VALIGN="TOP"><TT>-c</TT>

<TD>Lists all files in a package that are marked as configuration

<TR>

<TD VALIGN="TOP"><TT>-d</TT>

<TD>Lists all files in a package that are marked as documentation

<TR>

<TD><TT>-f <I>file</I></TT>

<TD>Lists the package that owns the specified file

<TR>

<TD><TT>-i</TT>

<TD>Lists the complete information for a package

<TR>

<TD><TT>-l</TT>

<TD>Lists all the files in a package

<TR>

<TD><TT>-p <I>package</I></TT>

<TD>Lists the package name of the specified package

<TR>

<TD><TT>-s</TT>

<TD>Lists the state of files in a package

<TR>

<TD COLSPAN="2"><HR>

</TABLE>

<P>If any of these options, except for <TT>-i</TT>, are given along with a <TT>-v</TT> option, then the files are listed in <TT>ls -l</TT> format:</P>

<!-- CODE SNIP //-->

<PRE>

<B># rpm -qlv kernel</B>

</PRE>

<!-- END CODE SNIP //-->

<P>This example outputs the following:

</P>

<!-- CODE SNIP //-->

<PRE>

-rw-r&#151;r---  root  root  104367 Dec 21 21:05 /boot/System.map-2.0.27

-rw-r&#151;r---  root  root   11773 Dec 21 21:05 /boot/module-info

-rw-r&#151;r---  root  root  449760 Dec 21 21:05 /boot/vmlinuz-2.0.27

</PRE>

<!-- END CODE SNIP //-->

<H4 ALIGN="LEFT"><A NAME="Heading8"></A><FONT COLOR="#000077">Verifying Packages</FONT></H4>

<P>Verifying packages is an easy way to determine whether there are any problems with an installation. In verification mode, <TT>rpm</TT> compares information about an installed package against information about the original package, which is stored in the package database at install time.</P>

<P>The basic syntax for verifying a package is as follows:</P>

<!-- CODE SNIP //-->

<PRE>

rpm -V [<I>package</I>]

</PRE>

<!-- END CODE SNIP //-->

<P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="521-524.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="528-533.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 + -