yum-software-management/zh_CN yum-software-management-zh_CN.xml, NONE, 1.1

Stuart Ellis (elliss) fedora-docs-commits at redhat.com
Sun Feb 5 20:34:21 UTC 2006


Author: elliss

Update of /cvs/docs/yum-software-management/zh_CN
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv8224/zh_CN

Added Files:
	yum-software-management-zh_CN.xml 
Log Message:
- Added rpm-info-en.xml.
- Rearranged to match new directory structure.



--- NEW FILE yum-software-management-zh_CN.xml ---
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY % FEDORA-ENTITIES-EN SYSTEM "../../docs-common/common/fedora-entities-en.ent">
%FEDORA-ENTITIES-EN;
<!ENTITY DOCNAME "yum-software-management">
<!ENTITY DOCVERSION "1.0.5">
<!ENTITY DOCDATE "2005-11-28">
<!ENTITY DOCID "&DOCNAME;-&DOCVERSION; (&DOCDATE;)">
<!ENTITY BOOKID "&DOCNAME;-&DOCVERSION; (&DOCDATE;)">
<!ENTITY FCLOCALVER "4">
]>
<article id="yum-software-management" lang="zh_CN">
  <articleinfo>
    <title>使用 <command>yum</command> 管理软件</title>
    <copyright>
      <year>2005</year>
      <holder>Stuart Ellis</holder>
    </copyright>
    <copyright>
      <year>2005</year>
      <holder>bbbush (bbbush.yuan at gmail.com)</holder>
    </copyright>
    <authorgroup>
      <author>
        <surname>Ellis</surname>
        <firstname>Stuart</firstname>
      </author>
    </authorgroup> &LEGALNOTICE; <revhistory><revision><revnumber>0.4</revnumber><date>2005-06-01</date><authorinitials>StuartEllis</authorinitials><revdescription><para>导入 CVS。</para></revdescription></revision><revision><revnumber>0.5</revnumber><date>2005-07-19</date><authorinitials>StuartEllis</authorinitials><revdescription><para>为 &FC; &FCLOCALVER; 更新。</para></revdescription></revision><revision><revnumber>0.6</revnumber><date>2005-07-25</date><authorinitials>PaulWFrields</authorinitials><revdescription><para>修正样式和用法;发布 BETA。</para></revdescription></revision><revision><revnumber>1.0</revnumber><date>2005-08-13</date><authorinitials>PaulWFrields</authorinitials><revdescription><para>正式发表于项目网站。</para></revdescription></revision><revision><revnumber>1.0.1</revnumber><date>2005-08-18</date><authorinitials>StuartEllis</authorinitials><revdescription><para>添加有关无仓库时的安装和手动添加密钥的内容!
 。</para></revdescription></revision><revision><revnumber>1.0.2</revnumber><date>2005-08-26</date><authorinitials>StuartEllis</authorinitials><revdescription><para>修正本地安装的内容。</para></revdescription></revision><revision><revnumber>1.0.3</revnumber><date>2005-10-13</date><authorinitials>PaulWFrields</authorinitials><revdescription><para>修正用词 (#170584)。</para></revdescription></revision><revision><revnumber>1.0.4</revnumber><date>2005-11-15</date><authorinitials>StuartEllis</authorinitials><revdescription><para>更新代理服务相关内容,修正 #166122。</para></revdescription></revision><revision><revnumber>1.0.5</revnumber><date>2005-11-28</date><authorinitials>PaulWFrields</authorinitials><revdescription><para>在某些地方使用 "&FC;" 代替 "&FED;"。</para></revdescription></revision></revhistory></articleinfo>
  <section id="sn-introduction">
    <title>介绍</title>
    <section id="sn-purpose">
      <title>目的</title>
      <para>这份文档记述了 &FED; 系统中软件管理的基本内容。文档涵盖了 &FED; 推荐使用的软件管理工具 <command>yum</command> 的主要功能。</para>
    </section>
    <section id="sn-software-management-audience">
      <title>读者</title>
      <para>本文档适于程度不同的所有 &FED; 用户。</para>
    </section>
    <section id="sn-software-management-usingdoc">
      <title>本文档的用法</title>
      <para>本文档是使用 <command>yum</command> 的参考。您可以选择阅读或全文阅读,取决于您的需求和掌握程度。如果您对系统还很陌生,可以在第一次使用 <command>yum</command> 之前先阅读 <xref linkend="sn-software-management-concepts"/>。有经验的 Linux 用户可以从 <xref linkend="sn-managing-packages"/> 开始。</para>
      <note>
        <title>过去版本的 &FC;</title>
        <para>本文档描述的 <command>yum</command> 的配置适用于 &FC; &FCLOCALVER; 系统。在 &FC; 3 中,您必须按照 <xref linkend="sn-authorizing-package-sources"/> 中的步骤才能启用 <command>yum</command>。</para>
      </note>
      <para>本文档中大多数范例使用了软件包 <filename>tsclient</filename>,它包含在 &FC; 里面。<filename>tsclient</filename> 软件包提供了一个用于远程桌面连接的应用程序。如果您成功安装了它,可以选择菜单 <menuchoice><guimenu>Applications</guimenu><guisubmenu>Internet</guisubmenu><guimenuitem>Terminal Server Client</guimenuitem></menuchoice> 来运行它。要应用这些例子,只要把 <filename>tsclient</filename> 替换为相关的软件包名称。&FED; 软件组的操作范例使用了 <filename>MySQL Database</filename> 组。</para>
      <important>
        <title>避免以 root 帐号登录</title>
        <para>您不需要以 <systemitem class="username">root</systemitem> 登录,仍然可以管理您的  &FED; 系统。本文档中包含的操作,如果需要 <systemitem class="username">root</systemitem> 权限,会提示您输入 <systemitem class="username">root</systemitem> 的密码。示例使用 <command>su <option>-c</option></command> 命令实现了这种功能。</para>
      </important>
    </section>
    <section id="sn-yum-additional-resources">
      <title>附加资源</title>
      <indexterm>
        <primary>yum</primary>
        <secondary>文档</secondary>
      </indexterm> <indexterm><primary>yum</primary><secondary>手册页</secondary></indexterm><para>本文档没有介绍 <command>yum</command> 工具的某些特性和选项。阅读 <command>man</command> 手册页的 <command>yum(8)</command> 和 <filename>yum.conf(5)</filename> 来学习它们,只要这样:</para><screen><userinput>man yum
man yum.conf</userinput></screen><indexterm><primary>yum</primary><secondary>网站</secondary></indexterm> <indexterm><primary>yum</primary><secondary>邮件列表</secondary></indexterm><para>互联网上其他有用的 <command>yum</command> 资源还有:</para><variablelist><varlistentry><term>项目网站</term><listitem><para><ulink url="http://linux.duke.edu/projects/yum/"/></para></listitem></varlistentry><varlistentry><term>用户的邮件列表</term><listitem><para><ulink url="https://lists.dulug.duke.edu/mailman/listinfo/yum/"/></para></listitem></varlistentry><varlistentry><term>开发的邮件列表</term><listitem><para><ulink url="https://lists.dulug.duke.edu/pipermail/yum-devel/"/></para></listitem></varlistentry></variablelist><tip><title>请先查阅 &BZ;</title><para>如果您的某个操作总是产生错误,请查阅 &BZ-URL; 并参考相关软件包的错误报告。某个软件包出错可能导致依赖于这个软件包的所有 <command>yum</co!
 mmand> 操作失败。请在 &BZ; 网站上提交相关 &FED; 软件包的错误报告。</para></tip></section>
  </section>
  <section id="sn-software-management-concepts">
    <title>软件管理概念</title>
    <section id="sn-about-packages">
      <title>关于软件包</title>
      <indexterm>
        <primary>软件包</primary>
        <secondary>定义</secondary>
      </indexterm>
      <para>&FED; 的软件和文档以一种称为 RPM <firstterm>软件包</firstterm> 的文件方式提供。每个软件包是一个压缩的文档,包含了内容信息,应用程序文件,图标,文档和用作管理的脚本。管理程序利用这些内容来安全地定位、安装和卸载软件。例如,&FED; 安装过程使用随 &FC; 附带的软件包来构建或升级符合您需要的系统。</para>
      <para>软件包也包含一个数字签名,以验证它们的来源。软件管理工具通过 GPG <firstterm>公钥</firstterm> 来验证这个签名。<command>yum</command> 和 <command>rpm</command> 工具共享同一个 <firstterm>keyring</firstterm>,它保存了所有有保障的软件包来源的公钥。系统管理员可以选择添加这些有保障的软件包来源。</para>
      <note>
        <title>&FED; 的所有软件包都是开源软件</title>
        <para>&FP; 提供的所有软件都是开源软件。您可以下载 &FED; 的软件包并安装到任意多的系统中。</para>
      </note>
    </section>
    <section id="sn-about-repositories">
      <title>关于仓库</title>
      <indexterm>
        <primary>仓库</primary>
        <secondary>定义</secondary>
      </indexterm>
      <para>
        <firstterm>仓库</firstterm> 是一个预备好的目录,或是一个网站,包含了软件包和索引文件。软件管理工具,类似 <command>yum</command>,可以在仓库中自动地定位并获取正确的 RPM 软件包。这样,您就不必手动搜索和安装新应用程序和升级补丁了。只用一个命令,您就可以更新系统中所有软件,也可以根据指定搜索目标来查找安装新软件。</para>
      <para>有一系列的服务器,为每个版本的 &FC; 分别提供了一些仓库。&FC; 中的软件管理工具已经预先配置为使用下列三个仓库:</para>
      <variablelist>
        <varlistentry>
          <term>Base</term>
          <listitem>
            <para>构成 &FC; 的软件包,和光盘上内容相同</para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>Updates</term>
          <listitem>
            <para>Base 仓库中软件包的更新版本</para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>&EX;</term>
          <listitem>
            <para>一大批附加的软件包</para>
          </listitem>
        </varlistentry>
      </variablelist>
      <note>
        <title>过去版本的 &FC;</title>
        <para>&FC; &FCLOCALVER; 自动地支持这三个仓库。如果是 &FC; 3 系统,您必须手动调整才能使用 &FEX;,可以按照 <xref linkend="sn-using-repositories"/> 来做。</para>
      </note>
      <warning>
        <title>&FED; 开发仓库</title>
        <para>&FC; 也包含了几个可选的仓库设置。它们提供测试的软件包,可以取代一个或多个标准的仓库。只有当您打算测试和开发 &FED; 软件时,才应当启用它们:<filename>fedora-devel</filename> (Rawhide), <filename>fedora-extras-devel</filename>, 和 <filename>updates-testing</filename>。</para>
      </warning>
      <para>第三方软件开发者通常也使用仓库,来提供自己软件的 &FED; 版本。要学习如何配置自己的 &FED; 系统来使用第三方仓库,可以阅读 <xref linkend="sn-using-repositories"/>。</para>
      <indexterm>
        <primary>软件组</primary>
        <secondary>定义</secondary>
      </indexterm>
      <para>您可以用 &FED; 仓库提供的 <firstterm>软件组</firstterm> 来管理相关的软件包集合。第三方仓库可以向这些组中添加软件包,也可以将自己的软件包放在新的组中。</para>
      <!-- SE: Some repositories use groups and some don't: I've tried to put this nicely. -->
<!-- SE: Using the admonition for this is not optimal, it just doesn't fit anywhere else. -->
      <note>
        <title>现有的软件组</title>
        <para>要查看您的 &FED; 系统中现有可用的软件组,运行命令 <command>su -c 'yum grouplist'</command>。</para>
      </note>
      <para>使用仓库来保证您总是用着软件的最新版。如果仓库中提供了某个软件包的多个版本,管理工具会自动选择最新的那个。</para>
      <caution>
        <title>安装软件,但不使用仓库</title>
        <para>如果您确信,没有任何一个仓库提供了您需要的某个软件,那么再尝试手动安装它。您可能需要手动地管理这个软件包,无法应用 &FED; 软件包管理工具。</para>
        <para>本文档中的 <command>yum</command> 命令使用仓库作为软件包来源。如果要使用 <command>yum</command> 从一个软件包文件来安装软件,可以参考 <xref linkend="sn-yum-installing-frompackage"/>。</para>
      </caution>
    </section>
    <section id="sn-about-dependencies">
      <title>关于依赖关系</title>
      <indexterm>
        <primary>依赖关系</primary>
        <secondary>定义</secondary>
      </indexterm>
      <para>&FED; 发行版中安装的某些文件属于 <firstterm>库</firstterm>,它为多个应用程序提供功能。如果一个应用程序需要某个特定的库,那么这个库就是一个 <firstterm>依赖</firstterm>。要正常地安装一个软件包,&FED; 必须首先满足它的依赖关系。一个 RPM 软件包的依赖信息储存在这个 RPM 文件中。</para>
      <para>
        <command>yum</command> 工具使用软件包依赖关系数据来保证一个应用程序在安装前,所有的要求都已满足。它自动地安装依赖的软件包,如果系统中没有的话。如果某个新的应用程序的要求与现有的软件冲突,<command>yum</command> 会放弃,不对系统做任何修改。</para>
    </section>
    <section id="sn-package-names">
      <title>理解软件包名称</title>
      <indexterm>
        <primary>软件包</primary>
        <secondary>硬件兼容性</secondary>
      </indexterm> <indexterm><primary>软件包</primary><secondary>命名</secondary></indexterm><para>每个软件包文件都有一个很长的名字,包含了几个最重要的信息。例如,这就是 &FC; 中 <filename>tsclient</filename> 软件包的全名:</para><screen><filename>tsclient-0.132-6.i386.rpm</filename></screen><para>管理工具处理软件包时,通常使用如下三种格式之一:</para><itemizedlist><listitem><para>软件包名称:<filename>tsclient</filename></para></listitem><listitem><para>带有版本号和发行版本的软件包名称:<filename>tsclient-0.132-6</filename></para>
<!-- In what instances is the release number not needed?  For many -->
<!-- package updates, only the release number might change. Although it -->
<!-- might be superfluous, it's never *bad* to include it, right? [PWF] -->
        </listitem><listitem><para>带有硬件架构的软件包名称:<filename>tsclient.i386</filename></para></listitem></itemizedlist><para>为了清楚明白,<command>yum</command> 以 <filename>名称.架构</filename> 的格式来列出软件包。仓库通常也将软件包存储在以架构区分的目录中。每次为软件包指定架构的时候,实际指定的是此软件对机器架构的 <emphasis>最低</emphasis> 要求。</para><variablelist><varlistentry><term>i386</term><listitem><para>适于任何现有的 Intel 兼容计算机</para></listitem></varlistentry><varlistentry><term>noarch</term><listitem><para>适于所有架构</para></listitem></varlistentry><varlistentry><term>ppc</term><listitem><para>适于 PowerPC 系统,例如 Apple Power Macintosh</para></listitem></varlistentry><varlistentry><term>x86_64</term><listitem><para>适于 64 位 Intel 处理器,例如 Opterons</para></listitem></varlistentry></variablelist><para>一些软件ä!
 ¼šä¸ºç‰¹æ®Šç±»åž‹çš„ Intel 处理器优化,为 <option>i386</option>, <option>i586</option>, <option>i686</option> å’Œ <option>x86_64</option> 计算机提供不同的软件包。如果机器中有 Intel 奔腾,VIA C3 或其他兼容的处理器,那么可以使用 <option>i586</option> 软件包。如果机器中有 Intel 高能奔腾或更强劲的处理器,或是有时兴的 AMD 处理器,那么可以使用 <option>i686</option> 软件包。</para><para>在 <command>yum</command> 的命令行中,应当使用软件包的短名称。<command>yum</command> 会自动在符合您的机器架构的仓库中,选择版本最新的软件包。</para><para>用其他命名格式指定软件包,可以避免默认行为,强制 <command>yum</command> 使用指定版本或架构的软件包。只有当您知道默认选择有问题,不适宜安装时才应当这样做。</para><tip><title>软件包名称</title><para>您可以在 <command>yum</command> 操作中,ä½!
 ¿ç”¨ä¸‹åˆ—任一格式来指定软件包:<replaceable>name</!
 replac
le>, <replaceable>name.architecture</replaceable>, <replaceable>name-version</replaceable>, <replaceable>name-version-release</replaceable>, <replaceable>name-version-release.architecture</replaceable>, 和 <replaceable>epoch:name-version-release.architecture</replaceable>。</para></tip></section>
  </section>
  <section id="sn-software-management-tools">
    <title>&FC; 中的软件管理工具</title>
    <indexterm>
      <primary>添加/移除应用程序工具</primary>
    </indexterm> <indexterm><primary>警告图标</primary></indexterm> <indexterm><primary>up2date</primary></indexterm><para><command>yum</command> 工具是一个完整的软件管理系统。&FC; 也包含其他几个应用程序,作为 <command>yum</command> 的补充。</para><para>您的桌面上有一个 <application>Alert Icon</application>,当软件包有更新时它会通知您。如果您的系统不是最新的,这个图标就显示为带有闪烁的感叹号的红色圆圈。警告图标是 <application>up2date</application> 的一部分,它让您可以简单地更新系统。</para><para>&FC; 也包含了一个 <application>system-config-packages</application> 工具。要在图形界面运行这个应用程序,从菜单中选择 <menuchoice><guimenu>Desktop</guimenu><guisubmenu>System Settings</guisubmenu><guimenuitem>Add/Remove Applications</guimenuitem></menuchoice>。与 <application>up2date</application> 和 <command>yum</command> 不同,<appl!
 ication>system-config-packages</application> 只能利用 &FC; 安装光盘中安装软件,无法使用仓库。这个应用程序用于系统还没有网络连接的时候。</para><para>命令行工具 <command>rpm</command> 有很多功能,主要是操作单独的 RPM 软件包。您可以利用它来手动地为系统安装和移除软件包。如果使用 <command>rpm</command> 工具安装软件,您必须手动地检测和安装任何依赖关系。因为这个原因,<command>yum</command> 是安装软件的首选方式。</para><caution><title>当前软件包版本</title><para><application>up2date</application> 和 <command>yum</command> 工具可以保证您安装的是最新版本的软件包。其他方式不保证软件包是否最新。</para></caution></section>
  <section id="sn-managing-packages">
    <title>使用 <command>yum</command> 管理软件</title>
    <indexterm>
      <primary>yum</primary>
      <secondary>软件管理</secondary>
    </indexterm>
    <para>使用 <command>yum</command> 工具改变系统中的软件配置,有四种选择:</para>
    <para>
      <itemizedlist>
        <listitem>
          <para>从仓库安装新软件</para>
        </listitem>
        <listitem>
          <para>从单独的软件包文件安装新软件</para>
        </listitem>
        <listitem>
          <para>更新您的系统中现有的软件</para>
        </listitem>
        <listitem>
          <para>从您的系统中移除不需要的软件</para>
        </listitem>
      </itemizedlist>
    </para>
    <!-- SE: This duplicates text from the admonition in sn-about-repositories.  It's here as well because the Fedora site has a link straight to this section -->
    <important>
      <title>从一个软件包文件安装软件</title>
      <para>本文档中的 <command>yum</command> 命令使用仓库作为软件包来源。如果要使用 <command>yum</command> 从一个软件包文件来安装软件,可以参考 <xref linkend="sn-yum-installing-frompackage"/>。</para>
    </important>
    <para>使用 <command>yum</command> 时,应指定一个操作,以及一个或多个软件包/软件组。</para>
    <para>对于每个操作,<command>yum</command> 都要从已配置的仓库中下载最新的软件包信息。如果您的网络连接比较慢,<command>yum</command> 会用数秒钟来下载仓库的索引以及软件包的文件头。</para>
    <para>为得到所需的结果,<command>yum</command> 工具搜索这些数据文件,产生最好的动作集合,然后显示待处理的事务,您可以批准是否继续。事务可能会包含安装,更新或删除额外的软件,以此来满足软件依赖关系。</para>
    <example id="yum-transaction-format">
      <title>
        <command>yum</command> 事务报告的格式</title>
      <para>这个范例是安装 <filename>tsclient</filename> 时的事务:</para>
      <screen>
        <computeroutput>=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 tsclient                i386       0.132-6          base              247 k
Installing for dependencies:
 rdesktop                i386       1.4.0-2          base              107 k

Transaction Summary
=============================================================================
Install      2 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 355 k
Is this ok [y/N]:</computeroutput>
      </screen>
    </example>
    <para>检视列表中的改变,然后按下 <keycap>y</keycap> 接受并开始。如果您按下 <keycap>N</keycap> 或 <keycap>Enter</keycap>(回车),<command>yum</command> 不会下载或改变任何软件。</para>
    <note>
      <title>软件包版本</title>
      <para>
        <command>yum</command> 工具只显示和使用软件包的最新版本,除非您指定一个旧版本。</para>
    </note>
    <para>
      <command>yum</command> 工具支持导入仓库公钥,如果它没有预装在 <command>rpm</command> 钥匙环中的话。</para>
    <example id="yum-publickey-import">
      <title>
        <command>yum</command> 公钥导入的格式</title>
      <para>这是公钥导入的一个例子:</para>
      <screen>
        <computeroutput>warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
public key not available for tsclient-0.132-6.i386.rpm
Retrieving GPG key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
Importing GPG key 0x4F2A6FD2 "Fedora Project <fedora at redhat.com>"
Is this ok [y/N]:</computeroutput>
      </screen>
    </example>
    <para>检查这个公钥,然后按下 <keycap>y</keycap> 来导入它,认可它的效力。如果您按下 <keycap>N</keycap> 或 <keycap>Enter</keycap>(回车),<command>yum</command> 停止,不安装任何软件包。</para>
    <para>为保证下载到的软件包是真实的,<command>yum</command> 用提供者的公钥校验每个软件包的数字签名。当事务需要的所有软件包都已成功下载并校验后,<command>yum</command> 将它们应用到您的系统中。</para>
    <para>每个完成的事务会在日志文件 <filename>/var/log/yum.log</filename> 中记录受影响的软件包。您只能以 <systemitem class="username">root</systemitem> 权限读取它。</para>
    <tip>
      <title>下载被缓存</title>
      <para>
        <command>yum</command> 工具保留已下载的数据文件和软件包以复用。如果需要,您可以从 <filename>/var/cache/yum/</filename> 下的仓库缓存目录中,将软件包复制出来,用于其他地方。缓存中的软件包即使被删除,也不会影响到您的系统中已经安装的软件。</para>
    </tip>
    <section id="sn-yum-installing-withrepositories">
      <title>使用 <command>yum</command> 安装新软件</title>
      <indexterm>
        <primary>安装软件</primary>
        <see>软件,安装</see>
      </indexterm> <indexterm><primary>软件</primary><secondary>安装</secondary></indexterm><para>要安装软件 <filename>tsclient</filename>,输入命令:</para><screen><userinput>su -c 'yum install <replaceable>tsclient</replaceable>'</userinput></screen><para>当提示时,输入 <systemitem class="username">root</systemitem> 帐号的密码。</para><para>要安装软件组 <filename>MySQL Database</filename>,输入命令:</para><screen><userinput>su -c 'yum groupinstall "<replaceable>MySQL Database</replaceable>"'</userinput></screen><para>当提示时,输入 <systemitem class="username">root</systemitem> 帐号的密码。</para><important><title>新的服务需要激活</title><para>当您安装一项服务的时候,&FED; 不会激活或启动它。要配置一项新服务随系统启动而运行,选择菜单中的 <menuchoice><guimenu>Desktop</guimenu><guisubmenu>System Settings</guisubmenu><guisubmenu>Server Settings</guisubmenu><guimenuitem>Ser!
 vices</guimenuitem></menuchoice>,或者使用命令行工具 <command>chkconfig</command> 和 <command>service</command>。</para></important></section>
    <section id="sn-yum-updating-withrepositories">
      <title>使用 <command>yum</command> 更新软件</title>
      <indexterm>
        <primary>æ›´æ–°</primary>
        <secondary>软件包</secondary>
      </indexterm> <indexterm><primary>软件</primary><secondary>æ›´æ–°</secondary></indexterm><para>要更新 <filename>tsclient</filename> 软件为最新版本,输入:</para><screen><userinput>su -c 'yum update <replaceable>tsclient</replaceable>'</userinput></screen><para>当提示时,输入 <systemitem class="username">root</systemitem> 帐号的密码。</para><important><title>新版本软件需要重新载入</title><para>如果您更新某个软件时,它正在被使用,那么旧版本仍然有效,直到您重新启动应用程序或服务。内核的更新必须到您重新启动系统时才可生效。</para></important><para>要更新软件组 <filename>MySQL Database</filename> 中的所有软件,输入命令:</para><screen><userinput>su -c 'yum groupupdate "<replaceable>MySQL Database</replaceable>"'</userinput></screen><para>当提示时,输入 <systemitem class="username">root</systemitem> 帐号的密码。</para><note><title>更新整个ç!
 ³»ç»Ÿ</title><para>要更新您的 &FED; 系统中的所有软件,使用 <xref linkend="sn-updating-your-system"/> 中提到的命令。</para></note></section>
    <section id="sn-yum-removing-software">
      <title>使用 <command>yum</command> 移除软件</title>
      <indexterm>
        <primary>移除软件</primary>
      </indexterm> <indexterm><primary>软件</primary><secondary>移除</secondary></indexterm><para>要移除软件,<command>yum</command> 在您的系统中检测指定被移除的软件,以及任何依赖于它的软件。移除软件的事务将移除这一软件及所有依赖于它的软件。</para><para>要移除 <filename>tsclient</filename> 软件,使用命令:</para><screen><userinput>su -c 'yum remove <replaceable>tsclient</replaceable>'</userinput></screen><para>当提示时,输入 <systemitem class="username">root</systemitem> 帐号的密码。</para><para>要移除软件组 <filename>MySQL Database</filename> 中的所有软件,使用命令:</para><screen><userinput>su -c 'yum groupremove "<replaceable>MySQL Database</replaceable>"'</userinput></screen><para>当提示时,输入 <systemitem class="username">root</systemitem> 帐号的密码。</para><note><title>数据和配置文件的保留情况</title><para>移除过程会保留用户数æ!
 ®ï¼Œä½†æ˜¯åœ¨æŸäº›æ—¶å€™ä¼šç§»é™¤é…ç½®æ–‡ä»¶ã€‚如果某个软件的移除不包括配置文件,而您在后面又重安装了这一软件,那么它可能会重用旧的配置文件。</para></note></section>
  </section>
  <section id="sn-searching-packages">
    <title>使用 <command>yum</command> 搜索软件</title>
    <indexterm>
      <primary>软件包</primary>
      <secondary>定位</secondary>
    </indexterm> <indexterm><primary>搜索</primary><secondary>软件包</secondary></indexterm><para>使用 <command>yum</command> 的搜索功能来查找已配置的仓库中可用的软件,或系统中已安装的软件。搜索自动包含这两类软件。</para><para>结果的格式依赖于所用的选项。如果查询没有给出结果,说明没有满足要求的软件。</para><section id="sn-searching-packages-byname"><title>通过软件名和属性搜索</title><para>要通过名称搜索,使用 <option>list</option> 功能。要搜索软件 <filename>tsclient</filename>,使用命令:</para><screen><userinput>su -c 'yum list <replaceable>tsclient</replaceable>'</userinput></screen><para>当提示时,输入 <systemitem class="username">root</systemitem> 帐号的密码。</para><para>要使搜索更精确,可以指定包含属性的名称,例如版本或硬件架构。要搜索 <filename>tsclient</filename> 的 0.132 版,使用命令:</para><!
 screen><userinput>su -c 'yum list <replaceable>tsclient-0.132</replaceable>'</userinput></screen><note><title>有效的软件属性</title><para>参见 <xref linkend="sn-package-names"/>,其中有软件包命名格式以及其中包含的属性等信息。</para></note></section><section id="sn-searching-packages-advanced"><title>高级搜索</title><para>如果您不知道软件的名称,使用 <option>search</option> 或 <option>provides</option> 功能。另外,可以在任何 <command>yum</command> 搜索选项中使用通配符和正则表达式,来扩大搜索范围。</para><para><option>search</option> 功能检测所有可用的软件的名称、描述、概述和已列出的维护者,查找匹配的值。例如,要从所有软件包中搜索与 PalmPilots 相关的内容,输入:</para><screen><userinput>su -c 'yum search <replaceable>PalmPilot</replaceable>'</userinput></screen><para>当提示时,输入 <systemitem class="username">root</systemit!
 em> 帐号的密码。</para><para><option>provides</option> å!
 ŠŸèƒ½æ
µ‹è½¯ä»¶åŒ…中包含的文件以及软件提供的功能。与 <option>search</option> 相比,这个选项要求 <command>yum</command> 下载并读取一个很大的索引文件。</para><para>要搜索所有包含文件 <filename>libneon</filename> 的软件包,输入:</para><screen><userinput>su -c 'yum provides <replaceable>libneon</replaceable>'</userinput></screen><para>要搜索所有提供了 MTA (Mail Transport Agent, 邮件传输代理) 服务,或名称中包含了 <filename>mta</filename> 的软件包:</para><screen><userinput>su -c 'yum provides <replaceable>MTA</replaceable>'</userinput></screen><para>对每个命令,应在提示时输入 <systemitem class="username">root</systemitem> 帐号的密码。</para><para>使用标准的通配符搭配词或名称的片段来搜索:<option>?</option> 代表任意单个字符,<option>*</option> 代表 0 或多个字符。在通配符前应当使用转义字符 (<option>\</option>)。</para><para>要 <opt!
 ion>list</option> 列出名称以 <filename>tsc</filename> 开始的软件,输入:</para><screen><userinput>su -c 'yum list <replaceable>tsc\*</replaceable>'</userinput></screen><tip><title>正则表达式</title><para>使用 Perl 或 Python 正则表达式来进行更复杂的查询。</para></tip></section><section id="sn-package-matches"><title>理解匹配</title><para>使用 <command>yum</command> 搜索会得出所有匹配您的搜索条件的软件。如果不使用通配符或正则表达式,那么只有准确地满足搜索条件的软件才视为匹配。</para><para>例如,搜索 <filename>shadowutils</filename> 或 <filename>shadow-util</filename> 的结果不会包含 <filename>shadow-utils</filename> 软件。如果搜索条件是 <filename>shadow-util\?</filename> 或 <filename>shadow\*</filename>,那么这个软件将视为匹配并显示出来。</para></section></section>
  <section id="sn-updating-your-system">
    <title>使用 <command>yum</command> 更新您的系统</title>
    <indexterm>
      <primary>æ›´æ–°</primary>
      <secondary>整个系统</secondary>
    </indexterm> <indexterm><primary>yum</primary><secondary>更新整个系统</secondary></indexterm><para>使用 <option>update</option> 功能来更新您的 &FED; 系统中所有软件为最新版,只要一个操作。</para><para>要进行整个系统的更新,输入命令:</para><screen><userinput>su -c 'yum update'</userinput></screen><para>在提示时,输入 <systemitem class="username">root</systemitem> 的密码。</para><section id="sn-automatic-updating"><title>自动更新您的系统</title><indexterm><primary>自动更新</primary></indexterm><para>&FC; 中的 <filename>yum</filename> 包含了一个脚本,用以每日自动地更新整个系统。要激活每日的自动更新,输入命令:</para><screen><userinput>su -c '/sbin/chkconfig --level 345 yum on; /sbin/service yum start'</userinput></screen><para>在提示时,输入 <systemitem class="username">root</systemitem> 帐号的密码。</para><note><title>每日更新是如何做到的<!
 /title><para>系统中并没有单独的 <command>yum</command> 服务。这个命令启用了控制脚本 <filename>/etc/rc.d/init.d/yum</filename>。这个控制脚本激活了 <filename>/etc/cron.daily/yum.cron</filename>,而它又会使 <command>cron</command> 服务来在每日凌晨四点时进行自动的系统更新。</para></note></section></section>
  <section id="sn-using-repositories">
    <title>使用其他软件仓库</title>
    <indexterm>
      <primary>&FEX;</primary>
    </indexterm> <indexterm><primary>仓库</primary><secondary>寻找</secondary></indexterm> <indexterm><primary>搜索</primary><secondary>仓库</secondary></indexterm><para>&FED; 系统自动使用 &FP; 的仓库。其中包括 &FEX;,默认没有包含在 &FC; 中的软件包。</para><note><title>适于旧版本 &FC; 的 &FEX; 仓库</title><para>您必须手动配置 &FC; 3 系统使用 &FEX;,按照 <ulink url="http://fedora.redhat.com/projects/extras/"/> 的步骤做。对于 &FC; 1 和 &FC; 2 的附加软件包,请查看 <ulink url="http://www.fedora.us/"/>。</para></note><para>如果 &FP; 没有包含某个软件,软件的作者可能提供了一个单独的仓库。一些社区的成员也维护了适于 &FED; 的软件仓库。例如,<ulink url="http://www.jpackage.org/"/> 将流行的 Java 软件打包发布。</para><section id="sn-adding-repositories"><title>添加仓库作为软件来源</title><indexterm><primary>仓库</primary><secondary>添加<!
 /secondary></indexterm><para>要另外添加一个仓库,必须在您的系统中 <filename>/etc/yum.repos.d/</filename> 目录下新建一个描述文件。仓库维护者一般会在网站上公布自己的仓库的描述文件。</para><tip><title>文件扩展名约定</title><para>仓库描述文件的名称以 <filename>.repo</filename> 结尾。</para></tip><para>您必须有 <systemitem class="username">root</systemitem> 权限才能向这个目录添加文件。要复制描述文件 <filename>example.repo</filename>,输入命令:</para><screen><userinput>su -c 'cp example.repo /etc/yum.repos.d/'</userinput></screen><para>在提示时,输入 <systemitem class="username">root</systemitem> 帐号的密码。</para><para>每个仓库的描述文件应当包含一个 <command>gpgkey</command> 配置项。这一配置项指定了为验证这一仓库的软件包所用的公钥的地址。这个公钥在第一次安装这个仓库中的软件时会自动导入。å¦!
 ‚果配置文件中没有包含这个配置项,请参见 <xr!
 ef lin
d="sn-authorizing-package-sources"/>。</para><note><title>仓库和 <application>up2date</application> 频道</title><para>从 &FC; 4 开始,<command>yum</command> 仓库被自动用作 <application>up2date</application> 频道。在 &FC; 3 和更老版本的系统中,您必须手动配置 <application>up2date</application> 使用这些频道。具体的步骤是修改文件 <filename>/etc/sysconfig/rhn/sources</filename>。</para></note></section><section id="sn-authorizing-package-sources"><title>手动认证软件来源</title><indexterm><primary>公钥</primary><secondary>添加</secondary></indexterm><para>要手动向 <command>rpm</command> 钥匙环中添加公钥,使用 <command>rpm</command> 的 <option>import</option> 功能。要导入文件 <filename>GPG-PUB-KEY.asc</filename>,输入命令:</para><screen><userinput>su -c 'rpm --import <replaceable>GPG-PUB-KEY.asc</replaceable>'</userinput></screen><para>在提示时,输入 <systemitem class="username!
 ">root</systemitem> 帐号的密码。</para><para>您可以直接从一个网站上导入公钥。例如,要导入网站 <wordasword>www.therepository.com</wordasword> 上的文件 <filename>GPG-PUB-KEY.asc</filename>,使用命令:</para><screen><userinput>su -c 'rpm --import <replaceable>http://www.therepository.com/GPG-PUB-KEY.asc</replaceable>'</userinput></screen><para>在提示时,输入 <systemitem class="username">root</systemitem> 的密码。</para><important><title>在 &FC; 3 中导入 &FED; 公钥</title><para>要在 &FC; 3 系统中向 <command>rpm</command> 钥匙环添加 &FED; 的公钥,使用命令 <command>su -c 'rpm --import /usr/share/rhn/RPM-GPG-KEY-fedora'</command>。</para></important></section><section id="sn-compat-repositories"><title>理解仓库相容性</title><indexterm><primary>软件包</primary><secondary>软件相容性</secondary></indexterm> <indexterm><primary>仓库</primary><secondary>相容性</secondary></indexterm><para>&!
 FEX; 仓库提供了按照与 &FC; 相同的标准构建的软!
 件。
三方软件总是会与 &FP; 软件包相容,如果不是,提供者会给出特别的说明。</para><para>在您将一个仓库添加为软件来源之前,一定要阅读仓库所属的网站上有关软件相容性的信息。不同的仓库提供者可能提供同一个软件的不同的不相容的版本。第三方仓库也可能提供 &FED; 仓库中软件的替代软件包。</para><para>替代软件包可能是软件的不同版本,功能与 &FP; 仓库中的版本不同。在将 &FP; 版本的软件包替换掉前,仔细考虑其中的好处和可能的不相容情况。</para><caution><title>不相容的仓库</title><para>如果您配置您的系统使用了不相容的仓库,<command>yum</command> 会无法操作。</para></caution><para>为一个版本的 &FED; 构建的软件包通常与另一个版本的 &FED; 不相容。提供者的网站总是会特别地说明所支持的 &FED; 版本。</para><tip><title>旧版本的 <command>yum</command> å’!
 Œå½“前的仓库</title><para>在 <command>yum</command> 2.1 发布时,仓库索引的数据格式发生了变化。在 &FC; 3 中即是这一格式。仓库提供者应当说明所支持的 &FC; 版本。要确认一个未说明的仓库是否与新版本的 <command>yum</command> 相容,只要查看它是否有一个叫做 <filename>repodata/</filename> 的子目录。</para></tip></section></section>
  <section id="sn-yum-installing-frompackage">
    <title>从一个单独的软件包文件安装软件</title>
    <indexterm>
      <primary>安装软件</primary>
      <secondary>从软件包</secondary>
      <see>从软件包安装软件</see>
    </indexterm> <indexterm><primary>软件</primary><secondary>从软件包安装软件</secondary></indexterm><para>使用仓库和标准的 <command>yum</command> 命令来定位并安装新软件,除非软件无法从任何一个仓库中找到。这种情况下,只能用 <option>localinstall</option> 功能来从软件包安装软件了。</para><important><title>必须有公钥</title><para>确保在安装没有仓库的软件之前,已经导入了软件来源的公钥。参见 <xref linkend="sn-authorizing-package-sources"/>。</para></important><para>要安装软件包 <filename>tsclient-0.132-4.i386.rpm</filename>,输入命令:</para><screen><userinput>su -c 'yum localinstall <replaceable>tsclient-0.132-4.i386.rpm</replaceable>'</userinput></screen><para>在提示时,输入 <systemitem class="username">root</systemitem> 的密码。</para><note><title>过去安装的软件将被更新</title><para>如果软件提供了已安装软件的新版本,<comma!
 nd>yum</command> 将更新已安装的软件。</para></note><para>如果软件包需要系统中未安装的软件,<command>yum</command> 会尝试利用已配置的仓库来满足依赖关系。您可能需要手动下载并安装额外的软件来满足所有的依赖关系。</para><caution><title>手动维护已安装的软件</title><para>如果您安装了并非来自仓库的软件,当它有新版时,<command>yum update</command> 无法自动更新它。为保证您总是用着最新的软件,可以订阅一份电子邮件或 RSS 服务,这样当有新版时可以得到通知。</para></caution></section>
  <section id="sn-yum-maintenance">
    <title>调整 <command>yum</command></title>
    <para>
      <command>yum</command> 不需要任何日常的维护。为保证 <command>yum</command> 操作的速度,您应当禁用或删除那些不再需要的仓库。您还可以删除 <command>yum</command> 缓存中的文件,从而节省硬盘空间。</para>
    <section id="sn-removing-sources">
      <title>禁用或删除软件来源</title>
      <indexterm>
        <primary>仓库</primary>
        <secondary>禁用</secondary>
      </indexterm> <indexterm><primary>仓库</primary><secondary>删除</secondary></indexterm><para>在仓库的描述文件中设置 <command>enable=0</command> 可以禁止 <command>yum</command> 使用这个仓库。<command>yum</command> 工具忽略包含这一设置的描述文件。</para><para>要彻底删除一个仓库</para><procedure><step><para>从 <filename>/etc/yum.repos.d/</filename> 目录中删除相关的文件。</para></step><step><para>从 <filename>/var/cache/yum/</filename> 目录中删除相关的缓存目录。</para></step></procedure>
<!-- What with the "web of trust," removing GPG keys is not really -->
<!-- something we should encourage. Having an extra GPG key in the RPM -->
<!-- database is not a vulnerability, nor does it hamper the system in -->
<!-- any way.  These are probably a couple of reasons Seth didn't build -->
<!-- this function into yum as part of "clean all," for example.  Since -->
<!-- we just had several admonitions against people running the rpm -->
<!-- command on its own anyway, I would just omit this part -->
<!-- completely. [PWF] -->
<!--

      <important>
        <title>Remove Unneeded Public Keys</title>

        <para>
          If you will not be using any further packages from a provider,
	  remove their public key from the <command>rpm</command>
	  keyring using the procedure described in
          <xref linkend="sn-removing-publickeys" />.
        </para>
      </important>
    </section>

    <section id="sn-removing-publickeys">
      <title>Removing Public Keys</title>
      <indexterm>
        <primary>public keys, removing</primary>
      </indexterm>
      <para>
        To remove a public key from the keyring you first must determine
        the full name of the key, as it registered in
        <command>rpm</command>. Run this command to view the details of
        the public keys on the <command>rpm</command> keyring:
      </para>
<screen>
<userinput>rpm -qi gpg-pubkey-*</userinput>
</screen>
      <para>
        Locate the heading for the relevant public key. The public key
        headings follow this format:
      </para>

      <example id="publickey-header-format">
        <title>Format of <command>rpm</command> Public Key Headers</title>
<screen>
<computeroutput>Name        : gpg-pubkey                   Relocations: (not relocatable)
Version     : 4f2a6fd2                          Vendor: (none)
Release     : 3f9d9d3b                      Build Date: Wed 15 Jun 2005 09:55:33 PM BST
Install Date: Wed 15 Jun 2005 09:55:33 PM BST      Build Host: localhost
Group       : Public Keys                   Source RPM: (none)
Size        : 0                                License: pubkey
Signature   : (none)
Summary     : gpg(Fedora Project <fedora at redhat.com>)
Description :</computeroutput>
</screen>
      </example>

      <para>
        Add the <option>Version</option> and <option>Release</option>
        attributes to <option>gpg-pubkey-</option> to make the complete
        name of the key, in the form
        <option>gpg-pubkey-Version_number-Release_number</option>. The
        <command>rpm</command> identification for the &FP; public key
        shown above is: <option>gpg-pubkey-4f2a6fd2-3f9d9d3b</option>.
      </para>

      <para>
        Once you know the identification name of the key, use the
        command <command>rpm <option>-e</option></command> to remove it.
        To remove the &FP; public key shown above the exact command
        would be:
      </para>
<screen>
<userinput>su -c 'rpm -e <replaceable>gpg-pubkey-4f2a6fd2-3f9d9d3b</replaceable>'</userinput>
</screen>
      <para>
        Enter the password for the
        <systemitem class="username">root</systemitem> account when
        prompted.
      </para>

-->
    </section>
    <section id="sn-yum-clearance">
      <title>清空 <command>yum</command> 缓存</title>
      <indexterm>
        <primary>yum</primary>
        <secondary>清空缓存</secondary>
      </indexterm>
      <para>默认情况下,<command>yum</command> 保留它下载的软件包和软件信息文件,这样将来可以复用它们,不必重新下载。要删除软件信息文件,使用命令:</para>
      <screen>
        <userinput>su -c 'yum clean headers'</userinput>
      </screen>
      <para>要删除缓存中所有软件包,使用命令:</para>
      <screen>
        <userinput>su -c 'yum clean packages'</userinput>
      </screen>
      <para>在提示时,输入 <systemitem class="username">root</systemitem> 帐号的密码。</para>
      <para>删除已缓存的文件,下次需要它们时,必须重新下载。这样,完成操作需要的时间会增加。</para>
    </section>
  </section>
  <section id="sn-yum-proxy-server">
    <title>有代理服务器时使用 <command>yum</command></title>
    <indexterm>
      <primary>代理服务器</primary>
    </indexterm> <indexterm><primary>yum</primary><secondary>有代理服务器时的使用</secondary></indexterm><para>默认情况下,<command>yum</command> 通过 HTTP 连接到网络上的仓库。所有 <command>yum</command> HTTP 操作都使用 HTTP/1.1,与支持这一标准的 web 代理服务器兼容。您也可以连接到 FTP 仓库,并配置 <command>yum</command> 使用 FTP 代理服务器。<filename>squid</filename> 软件包同时提供了 HTTP/1.1 和 FTP 连接的代理服务。</para><tip><title>为网络兼容性调整 <command>yum</command></title><para>请参考 <filename>yum.conf</filename> 的手册页中,可修改的 HTTP 设置,以与非标准的 web 代理服务器兼容。或者,配置 <command>yum</command> 使用 FTP 代理服务器并访问 FTP 仓库。&FED; 仓库同时支持 HTTP 和 FTP。</para></tip><section id="sn-yum-proxy-server-global"><title>配置代理服务器访问</title><para>要设置所有 <command>yum</command>!
  操作都使用代理服务器,可以在 <filename>/etc/yum.conf</filename> 中设置代理服务器的信息。<option>proxy</option> 配置项必须设定为完整的代理服务器的 URL,包含 TCP 端口号在内。如果您的代理服务器要求用户名和密码,可以用 <option>proxy_username</option> 和 <option>proxy_password</option> 配置项来指定它们。</para><para>这一配置使得 <command>yum</command> 使用代理服务器 <systemitem class="systemname">mycache.mydomain.com</systemitem>,连接端口号 3128,用户名 <systemitem class="username">yum-user</systemitem>,密码 <systemitem>qwerty</systemitem>。</para><example id="config-file-httpproxy"><title>配置文件设定,以使用代理服务器</title><screen><computeroutput># 代理服务器 - proxy server:port number
proxy=http://mycache.mydomain.com:3128
# 用于 yum 连接的帐户细节
proxy_username=yum-user
proxy_password=qwerty</computeroutput></screen></example><note><title>全局设置</title><para>如果您在 <filename>/etc/yum.conf</filename> 中定义代理服务器,<emphasis>所有</emphasis> 用户在使用 <command>yum</command> 时都会应用这个代理服务器设置。</para></note></section><section id="sn-yum-proxy-server-peruser"><title>为单个用户配置代理服务器</title><para>要为一个特定的用户启用代理访问,只要将实例框中的文本行加入这个用户的 shell 配置中。对于默认的 <command>bash</command> shell,配置是在 <filename>~/.bash_profile</filename> 中。这一设置使得 <command>yum</command> 使用代理服务器 <systemitem class="systemname">mycache.mydomain.com</systemitem>,连接端口号 3128。</para><example id="profile-script-httpproxy"><title>配置设定,为使用代理服务器</title><screen><computeroutput># 这个帐号使用的代理服务器
http_proxy="http://mycache.mydomain.com:3128"
export http_proxy</computeroutput></screen></example><para>如果代理服务器需要用户名和密码,只要将它们加入 URL。要包含用户名 <systemitem class="username">yum-user</systemitem>,密码 <systemitem>qwerty</systemitem>,添加设定:</para><example id="profile-script-httpproxy-withpassword"><title>配置设定,针对安全的代理服务器</title><screen><computeroutput># 这个帐号使用的代理服务器和用户名/密码
http_proxy="http://yum-user:qwerty@mycache.mydomain.com:3128"
export http_proxy</computeroutput></screen></example><note><title>环境变量 <option>http_proxy</option></title><para>环境变量 <command>http_proxy</command> 也为 <command>curl</command> 等其他工具所用。尽管 <command>yum</command> 可以识别大写或小写的 <command>http_proxy</command>,<command>curl</command> 要求环境变量的名称是小写。</para></note></section></section>
  <!-- SE: This is at the end of the document, since it looks out of place in section 1 -->
  <section id="sn-acknowledgements">
    <title>æ„Ÿè°¢</title>
    <para>Paul Frields 编辑了本文档。Timothy Murphy 检视了 BETA 发布。</para>
  </section>
  <index id="generated-index"/>
</article>




More information about the Fedora-docs-commits mailing list