0 - en to zh-CN translation catalogue (344 entries)

en: Maintenance and Updates: The APT Tools
zh-CN: 维护和更新：APT 工具

en: What makes Debian so popular with administrators is how easily software can be installed and how easily the whole system can be updated. This unique advantage is largely due to the <emphasis>APT</emphasis> program, which Falcot Corp administrators studied with enthusiasm.
zh-CN: Debian 之所以如此受系统管理员欢迎，是因为软件极易安装且整个系统的更新也极为简单。这一独特的优点主要得归功于 Falcot 公司系统管理员们热情研究的 <emphasis>APT</emphasis> 程序。

en: <emphasis>VOCABULARY</emphasis> Package source and source package
zh-CN: <emphasis>关键词</emphasis> 软件源和源码包

en: <primary>package source</primary><seealso>repository</seealso>
zh-CN: <primary>软件源</primary><seealso>仓库</seealso>

en: The word <emphasis>source</emphasis> can be ambiguous. A "source package" — a package containing the source code of a program — should not be confused with a "package source" — a repository (website, FTP server, CD-ROM, local directory, etc.) which contains packages.
zh-CN: <emphasis>源</emphasis>这个词可能会引起歧义。一个“源码包” — 是指一个包含有源程序代码的包，不要和“软件源”相混淆 — 这是指一个包所在的仓库（网站，FTP服务器，CD-ROM 光驱，本地磁盘等等）。

en: APT needs to be given a “list of package sources (repositories)”: the file <filename>/etc/apt/sources.list</filename> will list the different repositories that publish Debian packages. APT will then import the list of packages published by each of these sources. This operation is achieved by downloading <filename>Packages.xz</filename> files or a variant such as <filename>Packages.gz</filename> or <filename>.bz2</filename> (using a different compression method) in case of a source of binary packages and by analyzing their contents. In case of a source of source packages, APT downloads <filename>Sources.xz</filename> files or a variant using a different compression method. When an old copy of these files is already present, APT can update it by only downloading the differences (see sidebar <xref linkend="sidebar.apt-pdiff" />).
zh-CN: APT 需要指定一个“软件源（仓库）列表”：文件 <filename>/etc/apt/sources.list</filename> 会列出发布 Debian 软件包的不同仓库。接下来 APT 会从每一个软件源导入所发布的软件包列表。在二进制包的场景下，这个过程是通过下载 <filename>Packages.xz</filename> 文件或其它使用不同压缩方式的文件（比如 <filename>Packages.gz</filename> 或者 <filename>.bz2</filename>），并分析它们的内容来完成。在源码包的场景下，APT 下载 <filename>Sources.xz</filename> 文件或其它使用了不同压缩方式的文件。当这些文件的旧版本已经存在的时候，APT 仅下载更新的部分（见补充说明 <xref linkend="sidebar.apt-pdiff" />）。

en: <emphasis>BACK TO BASICS</emphasis> <command>gzip</command>, <command>bzip2</command>, <command>LZMA</command> and <command>XZ</command> Compression
zh-CN: <emphasis>基础知识</emphasis> <command>gzip</command>、<command>bzip2</command>、<command>LZMA</command> 和 <command>XZ</command> 压缩

en: A <filename>.gz</filename> extension refers to a file compressed with the <command>gzip</command> utility. <command>gzip</command> is the fast and efficient traditional Unix utility to compress files. Newer tools achieve better rates of compression but require more resources (computation time and memory) to compress and uncompress a file. Among them, and by order of appearance, there are <command>bzip2</command> (generating files with a <filename>.bz2</filename> extension), <command>lzma</command> (generating <filename>.lzma</filename> files) and <command>xz</command> (generating <filename>.xz</filename> files).
zh-CN: 文件名后缀 <filename>.gz</filename> 表示文件经过 <command>gzip</command> 工具的压缩。<command>gzip</command> 是一个快速且高效的经典 Unix 文件压缩工具。一些新的工具压缩比更好，但耗费更多的内存和时间来完成压缩和解压。按照出现的次序，这些工具有：<command>bzip2</command> （生成文件名后缀为 <filename>.bz2</filename>），<command>lzma</command>（生成文件名后缀为 <filename>.lzma</filename>）和 <command>xz</command>（生成文件名后缀为 <filename>.xz</filename>）。

en: Filling in the <filename>sources.list</filename> File
zh-CN: 编写 <filename>sources.list</filename> 文件

en: <primary>source</primary><secondary>of packages</secondary>
zh-CN: <primary>源</primary><secondary>软件包</secondary>

en: <primary>package</primary><secondary>source of</secondary>
zh-CN: <primary>软件包</primary><secondary>源</secondary>

en: Syntax
zh-CN: 语法

en: Each active line in the <filename>/etc/apt/sources.list</filename> file represents a package source (repository) and is made of at least three parts separated by spaces. For a complete description of the file format and the accepted entry compositions see <citerefentry><refentrytitle>sources.list</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
zh-CN: <filename>/etc/apt/sources.list</filename> 文件里处于激活状态每一行都代表一个软件包源（仓库），并且至少由空格分隔的三个部分组成。详细的文件格式和允许的条目组成参见 <citerefentry><refentrytitle>sources.list</refentrytitle><manvolnum>5</manvolnum></citerefentry>。

en: Example entry format in <filename>/etc/apt/sources.list</filename>
zh-CN: <filename>/etc/apt/sources.list</filename> 的格式样例

en: The first field indicates the source type:
zh-CN: 第一个字段标识源的类型：

en: package source (repository) of binary packages
zh-CN: 二进制软件包的软件包源（仓库）

en: package source (repository) of source packages
zh-CN: 源代码软件包的软件包源（仓库）

en: <emphasis>VOCABULARY</emphasis> The <literal>main</literal>, <literal>contrib</literal> and <literal>non-free</literal> archives
zh-CN: <emphasis>关键词</emphasis> <literal>main</literal>、<literal>contrib</literal>、<literal>non-free</literal>归档

en: <primary>component</primary><secondary><literal>main</literal></secondary>
zh-CN: <primary>组件</primary><secondary><literal>main</literal></secondary>

en: <primary><literal>main</literal>, component</primary>
zh-CN: <primary><literal>main</literal>，组件</primary>

en: <primary>component</primary><secondary><literal>contrib</literal></secondary>
zh-CN: <primary>组件</primary><secondary><literal>contrib</literal></secondary>

en: <primary><literal>contrib</literal>, component</primary>
zh-CN: <primary><literal>contrib</literal>，组件</primary>

en: <primary>component</primary><secondary><literal>non-free</literal></secondary>
zh-CN: <primary>组件</primary><secondary><literal>non-free</literal></secondary>

en: <primary><literal>non-free</literal>, component</primary>
zh-CN: <primary><literal>non-free</literal>，组件</primary>

en: <primary>component (of a repository)</primary>
zh-CN: <primary>（软件仓库的）组件名</primary>

en: The <literal>non-free</literal> component is different because it contains software which does not (entirely) conform to these principles but which can, nevertheless, be distributed without restrictions. This archive, which is not officially part of Debian, is a service for users who could need some of those programs and, nowadays, also require the firmware for their hardware. However, Debian always recommends giving priority to free software. The existence of this component represents a considerable problem for Richard M. Stallman and keeps the Free Software Foundation from recommending Debian to users.
zh-CN: <literal>non-free</literal> 组件则有所不同，它包括没有完全遵循上述原则，未受约束但仍然被发布的软件。这些不算是 Debian 官方的软件，服务于那些需要某些特殊应用及罕见硬件固件的用户。不过 Debian 向来都提倡优先使用自由软件的。这个组件的存在也应证了来自理查德·斯托曼 (Richard M. Stallman) 的值得深思的问题，使得自由软件基金会不向用户推荐 Debian。

en: <literal>Contrib</literal> (contributions) is a set of open source software which cannot function without some non-free elements — these elements can be software from the <literal>non-free</literal> section, or non-free files such as game ROMs, BIOS of consoles, etc. — or some elements, not available from the Debian <literal>main</literal> archive at all. The <literal>contrib</literal> component also includes free software whose compilation requires proprietary elements. This was initially the case for the OpenOffice.org office suite, which used to require a proprietary Java environment.
zh-CN: <literal>Contrib</literal> 是一类依赖一些非自由软件就才能正常运作的开源软件。这类软件是来自非自由的 <literal>non-free</literal> 部分的软件，或是非自由文件如游戏 ROMs、控制台的BIOS文件等等，或是在 Debian <literal>main</literal> 归档中完全不存在的软件。<literal>contrib</literal> 也包括那些需要私有软件来编译的自由软件。早先的例子就是 OpenOffice.org 办公软件套装，曾经需要带专利的 Java 环境来运行。

en: <emphasis>TIP</emphasis> Files in <filename>/etc/apt/sources.list.d/</filename>
zh-CN: <emphasis>技巧</emphasis> <filename>/etc/apt/sources.list.d/*.list</filename> 文件

en: If many package sources are referenced, it can be useful to split them in multiple files. Each part is then stored in <filename>/etc/apt/sources.list.d/<replaceable>filename</replaceable>.list</filename> (see sidebar <xref linkend="sidebar.directory.d" />).
zh-CN: 如果用了很多个软件包源，可以将它们分成多个文件。每一部分写在 <filename>/etc/apt/sources.list.d/<replaceable>filename</replaceable>.list</filename> 中（参见补充说明 <xref linkend="sidebar.directory.d" /> )。

en: The <literal>cdrom</literal> entries describe the CD/DVD-ROMs you have. Contrary to other entries, a CD-ROM is not always available since it has to be inserted into the drive and since only one disc can be read at a time. For those reasons, these sources are managed in a slightly different way, and need to be added with the <command>apt-cdrom</command> program, usually executed with the <literal>add</literal> parameter. The latter will then request the disc to be inserted in the drive and will browse its contents looking for <filename>Packages</filename> files. It will use these files to update its database of available packages (this operation is usually done by the <command>apt update</command> command). From then on, APT can require the disc to be inserted if it needs one of its packages.
zh-CN: <literal>cdrom</literal> 条目表示 CD、DVD 光盘。 跟其他条目不同，CD 光盘需要插入光驱中，并且每次只能读一张，所以并不总是可用。因此这种仓库管理起来稍有不同，需要用到 <command>apt-cdrom</command> 程序，经常与 <literal>add</literal> 参数一起执行。它会要求光驱中插入光盘，然后会浏览内容，寻找 <filename>Packages</filename> 文件。这些文件会用于更新可用软件包数据库（此过程由 <command>apt update</command> 命令完成）。自此，如果某些软件包需要光盘，APT 可发出插入光驱的要求。

en: Repositories for <emphasis role="distribution">Stable</emphasis> Users
zh-CN: 给<emphasis role="distribution">稳定版</emphasis>使用者的仓库

en: <primary><literal>stable-backports</literal></primary>
zh-CN: <primary><literal>稳定版-向后移植</literal></primary>

en: <primary><literal>stable-updates</literal></primary>
zh-CN: <primary><literal>稳定版-更新</literal></primary>

en: Here is a standard <filename>sources.list</filename> for a system running the <emphasis role="distribution">Stable</emphasis> version of Debian:
zh-CN: 下面是标准的<emphasis role="distribution">稳定版</emphasis> Debian <filename>sources.list</filename> 文件：

en: <filename>/etc/apt/sources.list</filename> file for users of Debian Stable
zh-CN: 给 Debian 稳定版用户的 <filename>/etc/apt/sources.list</filename> 文件

en: Note that when the desired version of a package is available on several repositories, the first one listed in the <filename>sources.list</filename> file will be used. For this reason, non-official sources are usually added at the end of the file.
zh-CN: 请注意，当你所需要的软件包版本同时存在于几个仓库中时，在文件 <filename>sources.list</filename> 中所列出的第一个会被使用。因此，非官方的软件源一般建议加在文件的末尾处。

en: As a side note, most of what this section says about <emphasis role="distribution">Stable</emphasis> applies equally well to <emphasis role="distribution">Oldstable</emphasis> since the latter is just an older <emphasis role="distribution">Stable</emphasis> that is maintained in parallel.
zh-CN: 补充一点，本节中提到内容不仅适用于 <emphasis role="distribution">Stable</emphasis> 版本，对于 <emphasis role="distribution">Oldstable</emphasis> 一样适用。后者只是同时在维护的更老旧的 <emphasis role="distribution">Stable</emphasis> 版本。

en: Security Updates
zh-CN: 安全更新

en: <primary>updates</primary><secondary>security updates</secondary>
zh-CN: <primary>更新</primary><secondary>安全更新</secondary>

en: <primary>Common Vulnerabilities and Exposures</primary><seealso>CVE</seealso>
zh-CN: <primary>通用漏洞批露</primary><seealso>CVE</seealso>

en: Debian takes security seriously. Known software vulnerabilities in Debian are tracked in the <ulink url="https://security-tracker.debian.org">Security Bug Tracker</ulink> and usually get fixed in a reasonable timeframe. The security updates are not hosted on the usual network of Debian mirrors but on <literal>security.debian.org</literal>, a small set of machines maintained by the <link linkend="dsa-team">Debian System Administrators</link>. This archive contains security updates prepared by the Debian Security Team and/or by package maintainers for the <emphasis role="distribution">Stable</emphasis> and <emphasis role="distribution">Oldstable</emphasis> distribution.
zh-CN: Debian 非常重视安全。已知的 Debian 软件漏洞会在 <ulink url="https://security-tracker.debian.org">Security Bug Tracker</ulink> 进行跟踪，而且通常会在合理时限内被修复。安全更新的内容通常不在 Debian 镜像站内，而是在 <literal>security.debian.org</literal>（由 <link linkend="dsa-team">Debian 系统管理员们</link>维护的小范围机器上）。上面的内容包括了那些由为 Debian 安全团队及软件包维护者提供给 <emphasis role="distribution">稳定版</emphasis> 和 <emphasis role="distribution">旧的稳定版</emphasis> 的安全更新。

en: For serious issues, the security team issues a <literal>Debian Security Advisory</literal> (<acronym>DSA</acronym>) and announces it together with the security update on the <email>debian-security-announce@lists.debian.org</email> mailing list (<ulink url="https://lists.debian.org/debian-security-announce/">archive</ulink>).
zh-CN: 对于严重的问题，安全团队会发布<literal> Debian 安全通告</literal>(<acronym>DSA</acronym>)，并且在 <email>debian-security-announce@lists.debian.org</email> 邮件列表（<ulink url="https://lists.debian.org/debian-security-announce/">邮件归档</ulink>）随着安全更新一起公告。

en: <primary>mailing lists</primary><secondary><email>debian-security-announce@lists.debian.org</email></secondary>
zh-CN: <primary>邮件列表</primary><secondary><email>debian-security-announce@lists.debian.org</email></secondary>

en: Stable Updates
zh-CN: 稳定版更新

en: <primary>stable updates</primary>
zh-CN: <primary>稳定版更新</primary>

en: Stable updates are not security sensitive but are deemed important enough to be pushed to users before the next stable point release.
zh-CN: 稳定版更新对安全性不敏感，在下一个稳定版本点发布前，它还是很重要，需要推送给使用者。

en: This repository will typically contain fixes for critical and serious bugs which could not be fixed before release or which have been introduced by subsequent updates. Depending on the urgency, it can also contain updates for packages that have to evolve over time, like <emphasis role="pkg">spamassassin</emphasis>'s spam detection rules, <emphasis role="pkg">clamav</emphasis>'s virus database, the daylight-saving time rules of all timezones (<emphasis role="pkg">tzdata</emphasis>), the <acronym>ESR</acronym> version of Firefox (<emphasis role="pkg">firefox-esr</emphasis>) or cryptographic keyrings like <emphasis role="pkg">debian-archive-keyring</emphasis>.
zh-CN: 这个仓库通常包括修正补丁，用于修复在发布前无法修复的严重漏洞和后续更新引入的漏洞。根据紧急性，它还包含长期的软件包更新，比如 <emphasis role="pkg">spamassassin</emphasis> 的垃圾邮件检测规则，<emphasis role="pkg">clamav</emphasis> 病毒库，各个时区的夏令时规则 (<emphasis role="pkg">tzdata</emphasis>)，Firefox 的延长支持<acronym>ESR</acronym>版 (<emphasis role="pkg">firefox-esr</emphasis>)，或是类似 <emphasis role="pkg">debian-archive-keyring</emphasis> 这种加密密钥。

en: In practice, this repository is a subset of the <literal>proposed-updates</literal> repository, carefully selected by the <link linkend="srm-team">Stable Release Managers</link>. All updates are announced on the <email>debian-stable-announce@lists.debian.org</email> mailing list (<ulink url="https://lists.debian.org/debian-stable-announce/">archive</ulink>) and will be included in the next <emphasis role="distribution">Stable</emphasis> point release anyway.
zh-CN: 实际上，这个仓库是由<link linkend="srm-team">稳定版发布管理员</link>从 <literal>proposed-updates</literal> 仓库中精心挑选的子集。所有更新都会在 <email>debian-stable-announce@lists.debian.org</email> 邮件列表 (<ulink url="https://lists.debian.org/debian-stable-announce/">archive</ulink>) 上公布，并且无论如何都会包含在下一个<emphasis role="distribution">稳定版</emphasis>的小版本更新中。

en: <primary>mailing lists</primary><secondary><email>debian-stable-announce@lists.debian.org</email></secondary>
zh-CN: <primary>邮件列表</primary><secondary><email>debian-stable-announce@lists.debian.org</email></secondary>

en: Proposed Updates
zh-CN: 计划更新

en: <primary><literal>proposed-updates</literal></primary>
zh-CN: <primary><literal>计划-更新</literal></primary>

en: <primary><literal>stable-proposed-updates</literal></primary>
zh-CN: <primary><literal>稳定版-计划更新</literal></primary>

en: <primary>updates</primary><secondary>proposed</secondary>
zh-CN: <primary>更新</primary><secondary>计划</secondary>

en: <primary>updates</primary><secondary><literal>stable-proposed</literal></secondary>
zh-CN: <primary>更新</primary><secondary><literal>稳定版-计划</literal></secondary>

en: <primary>updates</primary><secondary><literal>stable</literal>, proposed</secondary>
zh-CN: <primary>更新</primary><secondary><literal>稳定版</literal>，计划</secondary>

en: Once published, the <emphasis role="distribution">Stable</emphasis> distribution is only updated about once every 2 months. The <literal>proposed-updates</literal> repository is where the expected updates are prepared (under the supervision of the Stable Release Managers).
zh-CN: 一旦发布，<emphasis role="distribution">稳定版</emphasis>只会每两个月更新一次。接下来的更新在<literal>计划更新</literal>仓库里准备（由稳定版发布管理员监督）。

en: The security and stable updates documented in the former sections are always included in this repository, but there is more too, because package maintainers also have the opportunity to fix important bugs that do not deserve an immediate release.
zh-CN: 这个仓库不仅包含上一章节提到的安全更新和稳定更新的文件，还有更多内容，因为软件包维护者可能在这里修复一些不需要马上发布的重要漏洞。

en: Stable Backports
zh-CN: 稳定版向后移植

en: <primary>backport</primary>
zh-CN: <primary>向后移植</primary>

en: <primary>updates</primary><secondary>backports</secondary>
zh-CN: <primary>更新</primary><secondary>向后移植</secondary>

en: <primary>updates</primary><secondary><literal>stable-backports</literal></secondary>
zh-CN: <primary>更新</primary><secondary><literal>稳定版-向后移植</literal></secondary>

en: <primary>updates</primary><secondary><literal>stable</literal>, backports</secondary>
zh-CN: <primary>更新</primary><secondary><literal>稳定版</literal>，向后移植</secondary>

en: The <literal>stable-backports</literal> repository hosts “package backports”. The term refers to a package of some recent software which has been recompiled for an older distribution, generally for <emphasis role="distribution">Stable</emphasis>.
zh-CN: <literal>stable-backports</literal> 仓库存放“软件包的向后移植版本”。该术语指的是一些近期发布的软件针对旧的发行版重新编译的包，这里所指的旧发行版通常是指<emphasis role="distribution">稳定版(Stable)</emphasis>。

en: When the distribution becomes a little dated, numerous software projects have released new versions that are not integrated into the current <emphasis role="distribution">Stable</emphasis> suite, which is only modified to address the most critical problems, such as security issues. Since the <emphasis role="distribution">Testing</emphasis> and <emphasis role="distribution">Unstable</emphasis> suites can be more risky, package maintainers sometimes voluntarily offer recompilations of recent software applications for <emphasis role="distribution">Stable</emphasis>, which has the advantage to users and system administrators to limit potential instability to a small number of chosen packages. The page <ulink url="https://backports.debian.org" /> provides more information.
zh-CN: 当发行版本经过一段时间后，大量的软件项目都发布了新的软件版本，但它们都没有整合进入当前的<emphasis role="distrubution">稳定版</emphasis>（它仅接受那些解决最重要问题的修改，例如安全更新）。因为<emphasis role="distribution">测试版</emphasis>和<emphasis role="distribution">不稳定版</emphasis>均具有一定风险，软件包维护者有时会针对<emphasis role="distribution">稳定版</emphasis>提供近期发布的软件的重新编译版本，这样做可以将潜在的不稳定因素限制在一小部分经过筛选的软件包之间，因而具有一定的优势。<ulink url="http://backports.debian.org" /> 这个页面提供了更多信息。

en: Backports from <literal>stable-backports</literal> are only created from packages available in <emphasis role="distribution">Testing</emphasis>. This ensures that all installed backports will be upgradable to the corresponding stable version once the next stable release of Debian is available.
zh-CN: <literal>stable-backports</literal> 里面的软件向后移植版本通常是源自于<emphasis role="distribution">不稳定版</emphasis>的。这样能确保一旦下一个稳定的 Debian 版本可用，所有安装的向后移植版本软件都可以升级到相应的稳定版本。

en: Even though this repository provides newer versions of packages, <literal>APT</literal> will not install them unless you give explicit instructions to do so (or unless you have already done so with a former version of the given backport):
zh-CN: 尽管该仓库提供软件包较新的版本，<literal>APT</literal> 也只会在给出明确指令的情况下安装它们（或者你之前已经安装了对应软件的上一个向后移植版本）：

en: Repositories for <emphasis role="distribution">Testing</emphasis>/<emphasis role="distribution">Unstable</emphasis> Users
zh-CN: 给<emphasis role="distribution">测试版</emphasis>、<emphasis role="distribution">不稳定版</emphasis>用户的仓库

en: Here is a standard <filename>sources.list</filename> for a system running the <emphasis role="distribution">Testing</emphasis> or <emphasis role="distribution">Unstable</emphasis> version of Debian:
zh-CN: 下面是一个标准 <filename>sources.list</filename> 文件，用于<emphasis role="distribution">测试版</emphasis>或<emphasis role="distribution">不稳定版</emphasis>：

en: <filename>/etc/apt/sources.list</filename> file for users of Debian <emphasis role="distribution">Testing</emphasis>/<emphasis role="distribution">Unstable</emphasis>
zh-CN: Debian <emphasis role="distribution">测试版</emphasis>、<emphasis role="distribution">不稳定版</emphasis>用户的 <filename>/etc/apt/sources.list</filename> 文件

en: <emphasis>NOTE</emphasis> Layout of security repositories
zh-CN: <emphasis>注解</emphasis> 安全仓库的目录排列

en: With this <filename>sources.list</filename> file APT will install packages from the <emphasis role="distribution">Unstable</emphasis> suite. If that is not desired, use the <literal>APT::Default-Release</literal> setting (see <xref linkend="sect.apt-upgrade" />) to instruct APT to pick packages from another suite (most likely <emphasis role="distribution">Testing</emphasis> in this case).
zh-CN: 用上面的 <filename>sources.list</filename> 文件，APT 将安装软件包的<emphasis role="distribution">不稳定版</emphasis>。如果这不是你所期望的，可以用 <literal>APT::Default-Release</literal> 设置（参见 <xref linkend="sect.apt-upgrade" />）来指明 APT 从另外的版本获取软件包（这个例子中多数会使用<emphasis role="distribution">测试版</emphasis>）。

en: The inclusion of <emphasis role="distribution">Stable</emphasis> is more debatable but it often gives access to some packages, which have been removed from the development versions. It also ensures that you get the latest updates for packages, which have not been modified since the last stable release.
zh-CN: <emphasis role="distribution">稳定版</emphasis>的内容比较有争议，但它也常常保留了某些不再开发的软件包版本。同时也确保你能获取到尚未修改的最新软件包的更新包。

en: The <emphasis role="distribution">Experimental</emphasis> Repository
zh-CN: <emphasis role="distribution">实验性</emphasis>仓库

en: <primary><emphasis role="distribution">Experimental</emphasis></primary>
zh-CN: <primary><emphasis role="distribution">实验性</emphasis></primary>

en: The archive of <emphasis role="distribution">Experimental</emphasis> packages is present on all Debian mirrors, and contains packages which are not in the <emphasis role="distribution">Unstable</emphasis> version yet because of their substandard quality — they are often software development versions or pre-versions (alpha, beta, release candidate…). A package can also be sent there after undergoing subsequent changes which can generate problems. The maintainer then tries to uncover them with help from advanced users who can handle important issues. After this first stage, the package is moved into <emphasis role="distribution">Unstable</emphasis>, where it reaches a much larger audience and where it will be tested in much more detail.
zh-CN: 所有 Debian 镜像站都会包含<emphasis role="distribution">实验性</emphasis>的软件包，包括因为达不到质量要求尚未被纳入<emphasis role="distribution">不稳定版</emphasis>的软件包 — 通常是开发中的版本或发布前的前置版本(alpha、beta、rc 等)。软件包在经过修改后就会被放上来，多少会带来点问题。在能力强的高级用户的协助下，维护者会努力找出并修复这些问题。经过第一阶段后，软件包会移到<emphasis role="distribution">不稳定版</emphasis>仓库中，会有更多的用户以更详细的方式测试它。

en: <emphasis role="distribution">Experimental</emphasis> is generally used by users who do not mind breaking their system and then repairing it. This distribution gives the possibility to import a package which a user wants to try or use as the need arises. That is exactly how Debian approaches it, since adding it in APT's <filename>sources.list</filename> file does not lead to the systematic use of its packages. The line to be added is:
zh-CN: <emphasis role="distribution">实验性</emphasis>软件通常只有不在乎系统崩溃并且有能力自行修复的用户才会使用。用户可以导入此等软件包并测试其功能、检查是否满足其需求。这就是 Debian 的诉求，加入 APT 的 <filename>sources.list</filename> 内，并不表示该软件包可顺利使用，应加入下面这行：

en: Using Alternate Mirrors
zh-CN: 使用其他镜像

en: <primary><literal>deb.debian.org</literal></primary><see>mirrors</see>
zh-CN: <primary><literal>deb.debian.org</literal></primary><see>镜像</see>

en: <primary>mirrors</primary>
zh-CN: <primary>镜像</primary>

en: <primary>Content Delivery Networks</primary>
zh-CN: <primary>内容分发网络</primary>

en: <primary>mirror list</primary><seealso>mirrors</seealso>
zh-CN: <primary>镜像列表</primary><seealso>镜像</seealso>

en: <primary>list of mirrors</primary><seealso>mirrors</seealso>
zh-CN: <primary>镜像列表</primary><seealso>镜像</seealso>

en: Picky users who are not satisfied with the performance of <literal>deb.debian.org</literal> can try to find a better mirror in the official mirror list: <ulink type="block" url="https://www.debian.org/mirror/list" />
zh-CN: 对<literal>deb.debian.org</literal>的性能不满意的挑剔的用户可以尝试在官方镜像列表中找到更好的镜像：<ulink type="block" url="https://www.debian.org/mirror/list" />

en: But when you don't know which mirror is best for you, this list is of not much use. Fortunately for you, Debian maintains DNS entries of the form <literal>ftp.<replaceable>country-code</replaceable>.debian.org</literal> (e.g. <literal>ftp.us.debian.org</literal> for the USA, <literal>ftp.fr.debian.org</literal> for France, etc.) which are covering many countries and which are pointing to one (or more) of the best mirrors available within that country.
zh-CN: 当不知道那个镜像最适合自己时，这个列表没那么有用。幸运的是，Debian保留了DNS条目表<literal>ftp.<replaceable>country-code</replaceable>.debian.org</literal>（例如<literal>ftp.us.debian.org</literal>用于美国，<literal>ftp.fr.debian.org</literal>用于法国等），它涵盖了很多国家，并指向某个国家中的一个（或多个）最佳镜像。

en: <primary><literal>httpredir.debian.org</literal></primary><see>mirrors</see>
zh-CN: <primary><literal>httpredir.debian.org</literal></primary><see>镜像</see>

en: As an alternative to <literal>deb.debian.org</literal>, there used to be <literal>httpredir.debian.org</literal>. This service would identify a mirror close to you (among the list of official mirrors, using GeoIP mainly) and would redirect APT's requests to that mirror. This service has been deprecated due to reliability concerns and now <literal>httpredir.debian.org</literal> provides the same CDN-based service as <literal>deb.debian.org</literal>.
zh-CN: 之前使用 <literal>httpredir.debian.org</literal> 作为 <literal>deb.debian.org</literal> 的另一个选择。此服务会标识最近的镜像（在广泛镜像列表中，主要使用GeoIP）并重定向APT请求到该镜像。由于可靠性问题此服务已弃用，现在 <literal>httpredir.debian.org</literal> 提供与 <literal>deb.debian.org</literal> 相同的基于CDN的服务。

en: Non-Official Resources: <literal>mentors.debian.net</literal>
zh-CN: 非官方来源：<literal>mentors.debian.net</literal>

en: There are numerous non-official sources of Debian packages set up by advanced users who have recompiled some software — Ubuntu made this popular with their Personal Package Archive (<acronym>PPA</acronym>) service — by programmers who make their creation available to all, and even by Debian developers who offer pre-versions of their package online.
zh-CN: 高级用户们为一些重新编译过的软件建立了众多的非官方的 Debian 软件源 — Ubuntu 使用他们的个人包存（<acronym>PPA</acronym>）档服务 — 程序员提供他们编写的软件给所有人，甚至有 Debian 开发人员在线提供他们的软件包的预览版本。

en: The <ulink url="https://mentors.debian.net"><literal>mentors.debian.net</literal></ulink> site is interesting (although it only provides source packages), since it gathers packages created by candidates to the status of official Debian developer or by volunteers who wish to create Debian packages without going through that process of integration. These packages are made available without any guarantee regarding their quality; make sure that you check their origin and integrity and then test them before you consider using them in production.
zh-CN: <ulink url="https://mentors.debian.net"><literal>mentors.debian.net</literal></ulink> 站点比较有意思（虽然它只提供源码包），它搜集Debian开发者候选人员制作的软件包，以及那些希望创建Debian软件包又不想经历成为Debian开发者整套流程的那些志愿者的软件包。这些软件包提供时没有任何质量保证；请确保您在将它们用于生产环境之前检查它们的来源和完整性并进行测试。

en: <emphasis>COMMUNITY</emphasis> The <literal>debian.net</literal> sites
zh-CN: <emphasis>社区</emphasis> <literal>debian.net</literal> 站点

en: The <emphasis>debian.net</emphasis> domain is not an official resource of the Debian project. Each Debian developer may use that domain name for their own use. These websites can contain unofficial services (sometimes personal sites) hosted on a machine which does not belong to the project and set up by Debian developers, or even prototypes about to be moved on to <emphasis>debian.org</emphasis>. Two reasons can explain why some of these prototypes remain on <emphasis>debian.net</emphasis>: either no one has made the necessary effort to transform it into an official service (hosted on the <emphasis>debian.org</emphasis> domain, and with a certain guarantee of maintenance), or the service is too controversial to be officialized.
zh-CN: <emphasis>debian.net</emphasis> 域名不是一个 Debian 项目的官方源。每个 Debian 开发者都可基于自己用途而使用此域名。这些网址包含一些非官方服务（有时为个人站点），其主机不属于项目本身而由 Debian 开发者设置，甚至还有将要迁移到<emphasis>debian.org</emphasis>的项目原型。有两个理由来解释为什么这些项目原型会留在<emphasis>debian.net</emphasis>：或者是没有人做出足够的努力将其迁移到官方服务（ 位于<emphasis>debian.org</emphasis> 域名上，具备一定维护保证），或者是服务争议太大以至于无法官方化。

en: Installing a package means giving root rights to its creator, because they decide on the contents of the initialization scripts which are run under that identity. Official Debian packages are created by volunteers who have been co-opted and reviewed and who can seal their packages so that their origin and integrity can be checked.
zh-CN: 安装一个包意味着需要给包的创建者以 root 权限，因为其决定了以该身份运行的初始化脚本的内容。官方的 Debian 包由志愿者创建，志愿者经过指派和评估，且能封装软件包，因而软件包的来源与完整性可以确认。

en: In general, be wary of a package whose origin you don't know and which isn't hosted on one of the official Debian servers: evaluate the degree to which you can trust the creator, and check the integrity of the package.
zh-CN: 一般地，你要当心来源未知以及没有位于任一 Debian 官方服务器上的软件包：要评估包创建者的可信度，并检查包的完整性。

en: Caching Proxy for Debian Packages
zh-CN: Debian 软件包缓存代理

en: <primary>proxy cache</primary>
zh-CN: <primary>缓存代理</primary>

en: <primary>cache, proxy</primary>
zh-CN: <primary>缓存，代理</primary>

en: When an entire network of machines is configured to use the same remote server to download the same updated packages, any administrator knows that it would be beneficial to have an intermediate proxy acting as a network-local cache (see sidebar <xref linkend="sidebar.cache" />).
zh-CN: 当一整个网络的机器被配置为使用同样的远程服务器并下载同样的更新包时，管理员会知道有一个当作网络-本地缓存器的中介代理是有好处的（参见侧边栏<xref linkend="sidebar.cache" />）。

en: You can configure APT to use a "standard" proxy (see <xref linkend="sect.apt-config" /> for the APT side, and <xref linkend="sect.http-ftp-proxy" /> for the proxy side), but the Debian ecosystem offers better options to solve this problem. The dedicated software presented in this section are smarter than a plain proxy cache because they can rely on the specific structure of APT repositories (for instance they know when individual files are obsolete or not, and thus adjust the time during which they are kept).
zh-CN: 您可以配置 APT 使用一个“标准”的代理（参见<xref linkend="sect.apt-config" /> 获取 APT 相关内容，参见<xref linkend="sect.http-ftp-proxy" />获取代理相关内容），Debian 体系提供了一个解决问题的更佳手段。本节中所述的专用软件比普通的代理缓存更加智能，因为它们可依赖于 APT 软件源的特定结构（例如，它们了解单独的文件在什么时间废弃与否，并由此来调整在保持阶段的时间）。

en: <emphasis role="pkg">apt-cacher</emphasis> and <emphasis role="pkg">apt-cacher-ng</emphasis> work like usual proxy cache servers. APT's <filename>sources.list</filename> is left unchanged, but APT is configured to use them as proxy for outgoing requests.
zh-CN: <emphasis role="pkg">apt-cacher</emphasis>与<emphasis role="pkg">apt-cacher-ng</emphasis>的工作方式类似代理缓存服务器。对于外部请求，APT 的<filename>sources.list</filename> 保持不变，但是 APT 被配置为把它们作为代理使用。

en: <emphasis role="pkg">approx</emphasis>, on the other hand, acts like an HTTP server that “mirrors” any number of remote repositories in its top-level URLs. The mapping between those top-level directories and the remote URLs of the repositories is stored in <filename>/etc/approx/approx.conf</filename>:
zh-CN: 另一方面，<emphasis role="pkg">approx</emphasis>，工作方式则类似一个 HTTP 服务器，在它的顶级 URL 地址上“镜像”任意数量的远程软件源。这些顶级目录与远程 URL 之间的映射存储于<filename>/etc/approx/approx.conf</filename>中：

en: <emphasis role="pkg">approx</emphasis> runs by default on port 9999 via a systemd socket and requires the users to adjust their <filename>sources.list</filename> file to point to the approx server:
zh-CN: <emphasis role="pkg">approx</emphasis> 默认通过一个systemd socket在9999端口运行，并需要用户调整<filename>sources.list</filename> 文件来指向 approx 服务器：

en: <command>aptitude</command>, <command>apt-get</command>, and <command>apt</command> Commands
zh-CN: <command>aptitude</command>、<command>apt-get</command>和 <command>apt</command> 命令

en: <acronym>APT</acronym> is a vast project, whose original plans included a graphical interface. It is based on a library which contains the core application, and <command>apt-get</command> is the first front end — command-line based — which was developed within the project. <command>apt</command> is a second command-line based front end provided by APT which overcomes some design mistakes of <command>apt-get</command>.
zh-CN: <acronym>APT</acronym> 是个原先有图形接口的大计划。以包括核心应用程序的程序库为基础，且第一个前端 <command>apt-get</command> — 基于命令行 — 也包括在项目开发中。<command>apt</command> 是 APT 的第二个基于命令行的前端，包括若干 <command>apt-get</command> 错误的处理。

en: Numerous other graphical interfaces then appeared as external projects: <command>synaptic</command>, <command>aptitude</command> (which includes both a text mode interface and a graphical one — even if not complete yet), <command>wajig</command>, etc. The most recommended interface, <command>apt</command>, is the one that we will use in the examples given in this section. Note, however, that <command>apt-get</command> and <command>aptitude</command> have a very similar command line syntax. When there are major differences between these three commands, these will be detailed.
zh-CN: 其他众多的图形界面以外部项目形式出现：<command>synaptic</command>、<command>aptitude</command>（它同时包含文本模式界面和图形界面 — 即使尚未完成）、<command>wajig</command>等等。最为推荐的界面，<command>apt</command>，会在本节示例中使用。注意，尽管 <command>apt-get</command> 与 <command>aptitude</command> 的命令行语法也非常类似。在三个命令存在较大差异时，将会详述差异。

en: Initialization
zh-CN: 初始化

en: <emphasis>TIP</emphasis> Incremental updates
zh-CN: <emphasis>提示</emphasis> 增量更新

en: However, it can sometimes be of interest to force the download of the entire <filename>Packages</filename> file, especially when the last upgrade is very old and when the mechanism of incremental differences would not contribute much. This can also be interesting when network access is very fast but when the processor of the machine to upgrade is rather slow, since the time saved on the download is more than lost when the computer calculates the new versions of these files (starting with the older versions and applying the downloaded differences). To do that, you can use the APT configuration parameter <literal>Acquire::PDiffs</literal> and set it to <literal>false</literal>.
zh-CN: 然而，有的时候仍需要下载整个 <filename>Packages</filename> 文件，尤其是上回升级是很久以前的事且不适合增量式升级。若网络速度极快但机器的处理器性能不足以应付升级，下载省下的时间还不足以弥补电脑计算新版的时间 (从旧版开始逐一地升级)。在这种情况下，可以使用配置参数 <literal>Acquire::PDiffs</literal> 并设置为 <literal>false</literal>。

en: The <literal>Acquire::*</literal> options also control other aspects of the download, and even the download methods. <literal>Acquire::Languages</literal> can limit or disable the download of <filename>Translation-<replaceable>language-code</replaceable></filename> files and save even more time. For a complete reference see <citerefentry><refentrytitle>apt.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
zh-CN: <literal>Acquire::*</literal>选项控制下载的其它方面，甚至是下载方法。<literal>Acquire::Languages</literal>可以限制或禁止下载<filename>Translation-<replaceable>language-code</replaceable></filename>文件，并节省更多时间。全部信息请参考<citerefentry><refentrytitle>apt.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.

en: Installing and Removing
zh-CN: 安装和卸载

en: <primary>package</primary><secondary>installation</secondary>
zh-CN: <primary>软件包</primary><secondary>安装</secondary>

en: <primary>package</primary><secondary>removal</secondary>
zh-CN: <primary>软件包</primary><secondary>卸载</secondary>

en: <primary>installation</primary><secondary>package installation</secondary>
zh-CN: <primary>安装</primary><secondary>软件包安装</secondary>

en: <primary>removal of a package</primary>
zh-CN: <primary>卸载一个软件包</primary>

en: With APT, packages can be added or removed from the system, respectively with <command>apt install <replaceable>package</replaceable></command> and <command>apt remove <replaceable>package</replaceable></command>. In both cases, APT will automatically install the necessary dependencies or delete the packages which depend on the package that is being removed. The <command>apt purge <replaceable>package</replaceable></command> command involves a complete uninstallation by deleting the configuration files as well.
zh-CN: 通过APT，软件包可以从系统中添加或移除，命令分别为<command>apt install<replaceable>软件包</replaceable></command>、<command>apt remove<replaceable>软件包</replaceable></command>。在以上两种情况中，APT 将会自动安装必要的依赖包或者删除依赖于删除包的软件包。<command>apt purge<replaceable>软件包</replaceable></command>命令包含一个彻底删除 — 相关的配置文件也会被删除。

en: <emphasis>TIP</emphasis> Installing the same selection of packages several times
zh-CN: <emphasis>提示</emphasis> 多次安装同一批软件包

en: It can be useful to systematically install the same list of packages on several computers. This can be done quite easily.
zh-CN: 在几台电脑上安装同一批软件包会很实用。这很容易做到。

en: First, retrieve the list of packages installed on the computer which will serve as the “model” to copy.
zh-CN: 首先，从电脑中取得所安装软件包的列表作为用于复制的“模板”。

en: <computeroutput>$ </computeroutput><userinput>dpkg --get-selections &gt;pkg-list</userinput>
zh-CN: <computeroutput>$ </computeroutput><userinput>dpkg --get-selections &gt;pkg-list</userinput>↵

en: The <filename>pkg-list</filename> file then contains the list of installed packages. Next, transfer the <filename>pkg-list</filename> file onto the computers you want to update and use the following commands:
zh-CN: <filename>pkg-list</filename> 文件内容是已安装软件包的清单。然后，用以下的指令把 <filename>pkg-list</filename> 文件复制在欲更新的电脑：

en: ## Update dpkg's database of known packages
    # <userinput>avail=`mktemp`</userinput>
    # <userinput>apt-cache dumpavail &gt; "$avail"</userinput>
    # <userinput>dpkg --merge-avail "$avail"</userinput>
    # <userinput>rm -f "$avail"</userinput>
    ## Update dpkg's selections
    # <userinput>dpkg --set-selections &lt; pkg-list</userinput>
    ## Ask apt-get to install the selected packages
    # <userinput>apt-get dselect-upgrade</userinput>
zh-CN: ## 更新已知软件包的 dpkg 数据库↵
    # <userinput>avail=`mktemp`</userinput>↵
    # <userinput>apt-cache dumpavail &gt; "$avail"</userinput>↵
    # <userinput>dpkg --merge-avail "$avail"</userinput>↵
    # <userinput>rm -f "$avail"</userinput>↵
    ## 更新 dpkg 的选定项↵
    # <userinput>dpkg --set-selections &lt; pkg-list</userinput>↵
    ## 通知 apt-get 安装已选定的软件包↵
    # <userinput>apt-get dselect-upgrade</userinput>↵

en: The first commands record the list of available packages in the dpkg database. Then <command>dpkg --set-selections</command> restores the selection of packages that you wish to install, and the <command>apt-get</command> invocation executes the required operations! <command>aptitude</command> does not have this command.
zh-CN: 第一个命令记录在 dpkg 库中可用的软件包列表，然后 <command>dpkg --set-selections</command> 恢复选中你想要安装的包，<command>apt-get</command> 激活执行所需要的操作！<command>aptitude</command> 没有这样的命令。

en: <emphasis>TIP</emphasis> Removing and installing at the same time
zh-CN: <emphasis>提示</emphasis> 同时进行卸载和安装

en: It is possible to ask <command>apt</command> (or <command>apt-get</command>, or <command>aptitude</command>) to install certain packages and remove others on the same command line by adding a suffix. With an <command>apt install</command> command, add “<literal>-</literal>” to the names of the packages you wish to remove. With an <command>apt remove</command> command, add “<literal>+</literal>” to the names of the packages you wish to install.
zh-CN: 在命令 <command>apt</command> (或 <command>apt-get</command>、或 <command>aptitude</command>) 加入后缀就可以同时安装指定的软件包与移除其他软件包。在 <command>apt install</command> 命令加入 “<literal>-</literal>” 及希望移除的软件包名称。在 <command>apt remove</command> 命令加入 “<literal>+</literal>” 及希望安装的软件包名称。

en: The next example shows two different ways to install <replaceable>package1</replaceable> and to remove <replaceable>package2</replaceable>.
zh-CN: 下面的例子展示两种不同方法来安装<replaceable>package1</replaceable> 和卸载<replaceable>package2</replaceable>。

en: This can also be used to exclude packages which would otherwise be installed, for example, due to an automatic installation of <literal>Recommends</literal>. In general, the dependency solver will use that information as a hint to look for alternative solutions.
zh-CN: 此方法也可用于把不同的软件包排除在外，比如由于<literal>Recommends</literal>自动安装的软件包。一般，依赖解决者会用此作为寻找其他办法的线索。

en: <emphasis>TIP</emphasis> <command>apt --reinstall</command> and <command>aptitude reinstall</command>
zh-CN: <emphasis>技巧</emphasis> <command>apt --reinstall</command> 和 <command>aptitude reinstall</command>

en: <primary>reinstallation</primary>
zh-CN: <primary>重新安装</primary>

en: The system can sometimes be damaged after the removal or modification of files in a package. The easiest way to retrieve these files is to reinstall the affected package. Unfortunately, the packaging system finds that the latter is already installed and politely refuses to reinstall it; to avoid this, use the <literal>--reinstall</literal> option of the <command>apt</command> and <command>apt-get</command> commands. The following command reinstalls <emphasis role="pkg">postfix</emphasis> even if it is already present:
zh-CN: 在软件包中的文件发生移除或更改时，系统有时候可能会受损。恢复这些文件最简单的方法是重新安装受影响的软件包。不幸的是，包管理系统会认为后者已安装而拒绝重新安装；为了避免此情况，使用<command>apt</command>和<command>apt-get</command>命令的<literal> --reinstall</literal>选项。如下命令会重新安装<emphasis role="pkg">postfix</emphasis>，即使它已存在：

en: The <command>aptitude</command> command line is slightly different, but achieves the same result with <command>aptitude reinstall postfix</command>.
zh-CN: <command>aptitude</command>命令行略微不同，但可通过<command>aptitude reinstall postfix</command>获得同样的结果。

en: The problem does not arise with <command>dpkg</command>, but the administrator rarely uses it directly.
zh-CN: 该问题不与<command>dpkg</command>同时出现，但管理员极少直接使用它。

en: Be careful! Using <command>apt --reinstall</command> to restore packages modified during an attack will certainly not recover the system as it was. <xref linkend="sect.dealing-with-compromised-machine" /> details the necessary steps to take with a compromised system.
zh-CN: 注意！使用<command>apt --reinstall</command>命令恢复受到攻击时变更的软件包，不会当然地恢复系统原本的样子。<xref linkend="sect.dealing-with-compromised-machine" />详述了受损系统要采取的必要步骤。

en: These commands will not restore the configuration files. But as you have learned in <xref linkend="sect.conffiles" /> (see also sidebar <xref linkend="sidebar.questions-conffiles-bis" />), you can use the following command to be asked to install the unmodified version and even restore any deleted configuration file as well.
zh-CN: 这些命令不会恢复配置文件。但正如在 <xref linkend="sect.conffiles" /> （参阅侧边栏 <xref linkend="sidebar.questions-conffiles-bis" />）中描述，您可以使用要求安装未修改的版本，甚至还原任何已删除的配置文件。

en: Some packages don't ship the configuration file found in <filename>/etc</filename> with the package. Instead they create it during installation by either copying a skeleton or writing it by a script. The file <filename>/etc/inputrc</filename>, for example, is a copy of <filename>/usr/share/readline/inputrc</filename>. In such cases the commands shown above won't work.
zh-CN: 某些软件包不会将 <filename>/etc</filename> 中的配置文件一起发布。而是在安装时复制一个配置框架或通过脚本编写配置。例如，<filename>/etc/inputrc</filename> 文件是 <filename>/usr/share/readline/inputrc</filename> 的副本。在这种情况下，上面的命令将不起作用。

en: If the file <filename>sources.list</filename> mentions several distributions, it is possible to give the version of the package to install. A specific version number can be requested with <command>apt install <replaceable>package</replaceable>=<replaceable>version</replaceable></command>, but indicating its distribution of origin (<emphasis role="distribution">Stable</emphasis>, <emphasis role="distribution">Testing</emphasis> or <emphasis role="distribution">Unstable</emphasis>) — with <command>apt install <replaceable>package</replaceable>/<replaceable>distribution</replaceable></command> — is usually preferred. With this command, it is possible to go back to an older version of a package (if, for instance, you know that it works well), provided that it is still available in one of the sources referenced by the <filename>sources.list</filename> file. Otherwise the <literal>snapshot.debian.org</literal> archive can come to the rescue (see sidebar <xref linkend="sidebar.snapshot.debian.org" />).
zh-CN: 如果文件 <filename>sources.list</filename> 包含了数个发布版本，可以指定要安装软件包的版本。可以通过 <command>apt install <replaceable>package</replaceable>=<replaceable>version</replaceable></command>命令要求特定版本号，但以标明其初始发行版本 (<emphasis role="distribution">Stable</emphasis>, <emphasis role="distribution">Testing</emphasis> 或者 <emphasis role="distribution">Unstable</emphasis>）的方式— 通过 <command>apt install <replaceable>package</replaceable>/<replaceable>distribution</replaceable></command> — 更为推荐。倘若 <filename>sources.list</filename>文件所述软件源之一仍可用的情况下，通过此命令可以回溯一个软件包的旧版本 (比如您知晓其情况良好的情况)。否则，<literal>snapshot.debian.org</literal> 归档可以补救(参阅侧边栏 <xref linkend="sidebar.snapshot.debian.org" />)。

en: Installation of the <emphasis role="distribution">Unstable</emphasis> version of <emphasis role="pkg">spamassassin</emphasis>
zh-CN: 安装 <emphasis role="pkg">spamassassin</emphasis> 的 <emphasis role="distribution">Unstable</emphasis> 版本

en: <computeroutput># </computeroutput><userinput>apt install spamassassin/unstable</userinput>
zh-CN: <computeroutput># </computeroutput> <userinput>apt install spamassassin/unstable</userinput>

en: If the package to install has been made available to you under the form of a simple <filename>.deb</filename> file without any associated package repository, it is still possible to use APT to install it together with its dependencies (provided that the dependencies are available in the configured repositories) with a simple command: <command>apt install ./<replaceable>path-to-the-package.deb</replaceable></command>. The leading <literal>./</literal> is important to make it clear that we are referring to a filename and not to the name of a package available in one of the repositories.
zh-CN: 如果要安装没有关联存储库的简单 <filename>.deb</filename> 文件形式的软件包，仍然可以使用APT将其依赖项一起安装（前提是依赖项在配置的存储库中可用），使用简单命令： <command>apt install ./<replaceable>path-to-the-package.deb</replaceable></command>。前缀 <literal>./</literal> 必须明确，表示要安装的是一个文件名，而不是其中一个存储库中可用的软件包名称。

en: <emphasis>GOING FURTHER</emphasis> The cache of <filename>.deb</filename> files
zh-CN: <emphasis>扩展</emphasis> <filename>.deb</filename> 文件的缓存

en: APT keeps a copy of each downloaded <filename>.deb</filename> file in the directory <filename>/var/cache/apt/archives/</filename>. In case of frequent updates, this directory can quickly take a lot of disk space with several versions of each package; you should regularly sort through them. Two commands can be used: <command>apt-get clean</command> entirely empties the directory; <command>apt-get autoclean</command> only removes packages which can no longer be downloaded (because they have disappeared from the Debian mirror) and are therefore clearly useless (the configuration parameter <literal>APT::Clean-Installed</literal> can prevent the removal of <filename>.deb</filename> files that are currently installed).
zh-CN: APT 在<filename>/var/cache/apt/archives/</filename> 目录中保存每个下载的<filename> .deb</filename>文件的副本。在频繁更新的情况下，该目录下每个软件包的数个版本可能会占用大量磁盘空间；您应当经常整理它们。可以使用如下两个命令：<command>apt-get clean</command>完全清空整个目录；<command>apt-get autoclean</command>仅移除不会再下载的软件包（因为它们已从 Debian 镜像中消失）和明显无用的软件包（配置参数<literal>APT::Clean-Installed</literal>可以阻止移除安装中的<filename>.deb</filename>文件）。

en: System Upgrade
zh-CN: 系统升级

en: <primary>upgrade</primary><secondary>system upgrade</secondary>
zh-CN: <primary>升级</primary><secondary>系统升级</secondary>

en: Regular upgrades are recommended, because they include the latest security updates. To upgrade, use <command>apt upgrade</command>, <command>apt-get upgrade</command> or <command>aptitude safe-upgrade</command> (of course after <command>apt update</command>). This command looks for installed packages which can be upgraded without removing any packages. In other words, the goal is to ensure the least intrusive upgrade possible. <command>apt-get</command> is slightly more demanding than <command>aptitude</command> or <command>apt</command> because it will refuse to install packages which were not installed beforehand.
zh-CN: 常规升级是推荐的，因为它们包含最新的安全更新。要升级，可使用<command>apt upgrade</command>、<command>apt-get upgrade</command>、<command>aptitude safe-upgrade</command>（当然需在<command>apt update</command>之后）。该命令会查找要升级的已安装包，同时不移除任何包。也就是说，目标是确保可能的侵入式升级最小化。<command>apt-get</command>命令略苛刻于 <command>aptitude</command> 或 <command>apt</command>命令，因为它会拒绝安装未预先安装的软件包。

en: <command>apt</command> will generally select the most recent version number (except for packages from <emphasis role="distribution">Experimental</emphasis> and <emphasis role="distribution">stable-backports</emphasis>, which are ignored by default whatever their version number). If you specified <emphasis role="distribution">Testing</emphasis> or <emphasis role="distribution">Unstable</emphasis> in your <filename>sources.list</filename>, <command>apt upgrade</command> will switch most of your <emphasis role="distribution">Stable</emphasis> system to <emphasis role="distribution">Testing</emphasis> or <emphasis role="distribution">Unstable</emphasis>, which might not be what you intended.
zh-CN: <command>apt</command> 会选择最新的版本号 (除了来自 <emphasis role="distribution">Experimental</emphasis> 与 <emphasis role="distribution">stable-backports</emphasis>，其缺省忽略版本号)。若在 <filename>sources.list</filename> 内指定 <emphasis role="distribution">测试版</emphasis> 或 <emphasis role="distribution">不稳定版</emphasis> ，则 <command>apt upgrade</command> 会把 <emphasis role="distribution">稳定版</emphasis> 系统切换至 <emphasis role="distribution">测试版</emphasis> 或 <emphasis role="distribution">不稳定版</emphasis>，这些可能不是您要的。

en: To tell <command>apt</command> to use a specific distribution when searching for upgraded packages, you need to use the <literal>-t</literal> or <literal>--target-release</literal> option, followed by the name of the distribution you want (for example, <command>apt -t stable upgrade</command>). To avoid specifying this option every time you use <command>apt</command>, you can add <literal>APT::Default-Release "stable";</literal> in the file <filename>/etc/apt/apt.conf.d/local</filename>.
zh-CN: 搜索升级的软件包时需把特定的发行版告知 <command>apt</command>，采用 <literal>-t</literal> 或 <literal>--target-release</literal> 选项，然后是发行版的名称 (如：<command>apt -t stable upgrade</command>)。为了避免每次使用 <command>apt</command> 都需指定版本，可以把 <literal>APT::Default-Release "stable";</literal> 加在 <filename>/etc/apt/apt.conf.d/local</filename> 内。

en: For more important upgrades, such as the change from one major Debian version to the next, you need to use <command>apt full-upgrade</command>. With this instruction, <command>apt</command> will complete the upgrade even if it has to remove some obsolete packages or install new dependencies. This is also the command used by users who work daily with the Debian <emphasis role="distribution">Unstable</emphasis> release and follow its evolution day by day. It is so simple that it hardly needs explanation: APT's reputation is based on this great functionality.
zh-CN: 对于非常重要的升级，如从一个 Debian 主版本变更为下一版本，你需要使用<command>apt full-upgrade</command>。使用此命令，<command>apt</command>将会完全升级，即使必须移除一些废弃包或者安装新的依赖包。这也适用于日常使用 Debian <emphasis role="distribution"> Unstable</emphasis>并每天跟随其演化的用户。它是如此简便以至于几乎无需解释：APT的声誉基于此项强大的功能。

en: Unlike <command>apt</command> and <command>aptitude</command>, <command>apt-get</command> doesn't know the <command>full-upgrade</command> command. Instead, you should use <command>apt-get dist-upgrade</command> (”distribution upgrade”), the historical and well-known command that <command>apt</command> and <command>aptitude</command> also accept for the convenience of users who got used to it.
zh-CN: 不同于 <command>apt</command> 与 <command>aptitude</command>，<command>apt-get</command> 不能用 <command>full-upgrade</command> 命令。反而，您应使用 <command>apt-get dist-upgrade</command> (“升级发行版”)，此古老且知名的命令也被 <command>apt</command> 与 <command>aptitude</command> 接受，相当的便利。

en: The results of these operations are logged into <filename>/var/log/apt/history.log</filename> and <filename>/var/log/apt/term.log</filename>, whereas <command>dpkg</command> keeps its log in a file called <filename>/var/log/dpkg.log</filename>.
zh-CN: 这些操作的结果记录到 <filename>/var/log/apt/history.log</filename> 和 <filename>/var/log/apt/term.log</filename>，而 <command>dpkg</command> 的日志记录到文件 <filename>/var/log/dpkg.log</filename>。

en: Configuration Options
zh-CN: 配置选项

en: <primary>APT</primary><secondary>configuration</secondary>
zh-CN: <primary>APT</primary><secondary>配置</secondary>

en: Besides the configuration elements already mentioned, it is possible to configure certain aspects of APT by adding directives in a file of the <filename>/etc/apt/apt.conf.d/</filename> directory or <filename>/etc/apt/apt.conf</filename> itself. Remember, for instance, that it is possible for APT to tell <command>dpkg</command> to ignore file conflict errors by specifying <literal>DPkg::options { "--force-overwrite"; }</literal>.
zh-CN: 除了已提及的配置项目，还可在 <filename>/etc/apt/apt.conf.d/</filename> 文件夹内增加 APT 的其他配置文件或编辑 <filename>/etc/apt/apt.conf</filename> 本身。让 APT 告知 <command>dpkg</command> 忽略由 <literal>DPkg::options { "--force-overwrite"; }</literal> 引发的错误。

en: <emphasis>BACK TO BASICS</emphasis> Directories ending in <filename>.d</filename>
zh-CN: <emphasis>基础知识</emphasis> 结尾是 <filename>.d</filename> 的文件夹名称

en: Directories with a <filename>.d</filename> suffix are used more and more often. Each directory represents a configuration file which is split over multiple files. In this sense, all of the files in <filename>/etc/apt/apt.conf.d/</filename> are instructions for the configuration of APT. APT includes them in alphabetical order, so that the last ones can modify a configuration element defined in one of the first ones.
zh-CN: 结尾是 <filename>.d</filename> 数据使用机会愈来愈多。每个文件夹内的配置档分为多个文件。所以，在 <filename>/etc/apt/apt.conf.d/</filename> 内的文件都是供 APT 配置之用。APT 以字母顺序纳入他们，最后一个文件可以覆盖前的面的配置。

en: This structure brings some flexibility to the machine administrator and to the package maintainers. Indeed, the administrator can easily modify the configuration of the software by adding a ready-made file in the directory in question without having to change an existing file. Package maintainers use the same approach when they need to adapt the configuration of another software to ensure that it perfectly co-exists with theirs. The Debian policy explicitly forbids modifying configuration files of other packages — only users are allowed to do this. Remember that during a package upgrade, the user gets to choose the version of the configuration file that should be kept when a modification has been detected. Any external modification of the file would trigger that request, which would disturb the administrator, who is sure not to have changed anything.
zh-CN: 此结构对机器的管理者与软件包维护带来若干弹性。确实，管理者容易修改软件的配置，只需在有问题的文件夹添加文件而不必变动既有的文件。需要调整另一个软件的配置，以确保与既有软件相依，软件包维护者以同样的方法就能达成。Debian 的政策禁止修改其他软件包的配置档 — 只有被授权者才能修改。软件包升级时，用户应保留选择配置档版本的权力。外部修改此文件时将启动该选项，管理者就知道是外来的修改。

en: Depending on the application, the <filename>.d</filename> directory is used directly or managed by an external script which will concatenate all the files to create the configuration file itself. It is important to execute the script after any change in that directory so that the most recent modifications are taken into account. In the same way, it is important not to work directly in the configuration file created automatically, since everything would be lost at the next execution of the script. The chosen method (<filename>.d</filename> directory used directly or a file generated from that directory) is usually dictated by implementation constraints, but in both cases the gains in terms of configuration flexibility more than make up for the small complications that they entail. The Exim 4 mail server is an example of the generated file method: it can be configured through several files (<filename>/etc/exim4/conf.d/*</filename>) which are concatenated into <filename>/var/lib/exim4/config.autogenerated</filename> by the <command>update-exim4.conf</command> command.
zh-CN: 视应用程序的需要，可直接使用或由外部脚本管理 <filename>.d</filename> 文件夹，将所有文件串联成一个配置档。更动文件夹内容后，必须再运行脚本，才能纳入该等变动。还有一件重要的事，千万不要直接运行自动生成的配置档，因为下次运行脚本后将失去所有的东西。受到环境的限制才被迫选择指定的方法 (直接使用 <filename>.d</filename> 文件夹或由该文件夹产生的文件)，不论何种方法，配置的弹性收益远大于其带来的复杂性。Exim 4 邮件服务器是产生文件方法的范例之一：可用多个文件 (<filename>/etc/exim4/conf.d/*</filename>) 配置串联成 <filename>/var/lib/exim4/config.autogenerated</filename> 再由 <command>update-exim4.conf</command> 命令运行。

en: Managing Package Priorities
zh-CN: 软件包优先级管理

en: <primary>package</primary><secondary>priority</secondary>
zh-CN: <primary>软件包</primary><secondary>优先性</secondary>

en: <primary>priority</primary><secondary>package priority</secondary>
zh-CN: <primary>优先性</primary><secondary>软件包优先性</secondary>

en: One of the most important aspects in the configuration of APT is the management of the priorities associated with each package source. For instance, you might want to extend one distribution with one or two newer packages from <emphasis role="distribution">Testing</emphasis>, <emphasis role="distribution">Unstable</emphasis> or <emphasis role="distribution">Experimental</emphasis>. It is possible to assign a priority to each available package (the same package can have several priorities depending on its version or the distribution providing it). These priorities will influence APT's behavior: for each package, it will always select the version with the highest priority (except if this version is older than the installed one and if its priority is less than 1000).
zh-CN: 配置 APT 最重要的层面之一是管理每个软件包来源的优先性。例如，从 <emphasis role="distribution">测试版</emphasis>、<emphasis role="distribution">不稳定</emphasis> 或 <emphasis role="distribution">实验版</emphasis> 中选取一个或多个软件包。可以指定每个软件包的优先性 (视其版本或发行版，同个软件包可以有多个优先性)。这些优先性将影响 APT 的行为：每个软件包总是选择最优先的版本 (除非旧于已安装的版本或优先性小于 1000)。

en: <primary><filename>preferences</filename></primary>
zh-CN: <primary><filename>偏好</filename></primary>

en: <primary>APT</primary><secondary>preferences</secondary>
zh-CN: <primary>APT</primary><secondary>偏好</secondary>

en: APT defines several default priorities. Each installed package version has a priority of 100. A non-installed version has a priority of 500 by default, but it can jump to 990 if it is part of the target release (defined with the <literal>-t</literal> command-line option or the <literal>APT::Default-Release</literal> configuration directive).
zh-CN: APT 设置若干缺省的优先性。已安装软件包版本的优先性是 100。未安装版本缺省优先性为 500，若是另个发布的目标则可跳至 990 (以 <literal>-t</literal> 命令行选项或 <literal>APT::Default-Release</literal> 配置指令调整)。

en: You can modify the priorities by adding entries in a file in <filename>/etc/apt/preferences.d/</filename> or the <filename>/etc/apt/preferences</filename> file with the names of the affected packages, their version, their origin and their new priority.
zh-CN: 可以在 <filename>/etc/apt/preferences.d/</filename> 内添加包含条目的文件或向 <filename>/etc/apt/preferences</filename> 文件添加条目，指名受影响软件包名称、版本、出处及其新的优先性。

en: In more concrete terms, a package whose priority is
zh-CN: 更具体地说，一个软件包的优先性是

en: will never be installed,
zh-CN: 将永远不会被安装，

en: will only be installed if no other version of the package is already installed,
zh-CN: 则只会在没有安装其他版本时才安装，

en: will only be installed if there is no other newer version installed or available in another distribution,
zh-CN: 只有在没有安装其他较新版本或在其他发行版中可用的版本时才会安装，

en: will only be installed if there is no newer version installed or available in the target distribution,
zh-CN: 只有在目标分发中没有较新或可用版本时才安装，

en: will be installed except if the installed version is newer,
zh-CN: 除非已安装较新版本，否则都会安装，

en: will always be installed, even if it forces APT to downgrade to an older version.
zh-CN: 强制安装，即使APT会降级到较旧的版本。

en: <emphasis>SPECIFIC CASE</emphasis> Priority of <emphasis role="distribution">experimental</emphasis>
zh-CN: <emphasis>特例</emphasis><emphasis role="distribution">实验性</emphasis>的优先性

en: If you listed <emphasis role="distribution">Experimental</emphasis> in your <filename>sources.list</filename> file, the corresponding packages will almost never be installed because their default APT priority is 1. This is of course a specific case, designed to keep users from installing <emphasis role="distribution">Experimental</emphasis> packages by mistake. The packages can only be installed by typing <command>aptitude install <replaceable>package</replaceable>/experimental</command> — users typing this command can only be aware of the risks that they take. It is still possible (though <emphasis>not</emphasis> recommended) to treat packages of <emphasis role="distribution">Experimental</emphasis> like those of other distributions by giving them a priority of 500. This is done with a specific entry in <filename>/etc/apt/preferences</filename>:
zh-CN: 若把 <emphasis role="distribution">Experimental</emphasis> 列在 <filename>sources.list</filename> 文件内，几乎不会安装对应软件包，因为其 APT 优先性为1。当然这是特例，避免用户意外安装 <emphasis role="distribution">Experimental</emphasis> 软件包。这些软件包只能以指令 <command>aptitude install <replaceable>软件包名称</replaceable>/experimental</command> 安装 — 用户键入此指令时自然知道其风险。还是有可能 (虽然 <emphasis>不</emphasis> 推荐) 把 <emphasis role="distribution">Experimental</emphasis> 内的软件包视为其他发行版而给予优先性 100。在 <filename>/etc/apt/preferences</filename> 文件内给予特定的条目就行了：

en: Let's suppose that you only want to use packages from the stable version of Debian. Those provided in other versions should not be installed except if explicitly requested. You could write the following entries in the <filename>/etc/apt/preferences</filename> file:
zh-CN: 暂时假设您只需用到 Debian 稳定版的软件包。除非特别指明，不会安装其他版本的软件包。可以在 <filename>/etc/apt/preferences</filename> 文件内写入以下条目：

en: <literal>a=stable</literal> defines the name of the selected distribution. <literal>o=Debian</literal> limits the scope to packages whose origin is “Debian”.
zh-CN: <literal>a=stable</literal> 设置发行版的名称。<literal>o=Debian</literal> 限制来自 “Debian” 的软件包。

en: The reference documentation for the files <filename>/etc/apt/preferences</filename> and <filename>/etc/apt/preferences.d/</filename> is available in the manual page <citerefentry><refentrytitle>apt_preferences</refentrytitle><manvolnum>5</manvolnum></citerefentry>, which you can display with <command>man apt_preferences</command>.
zh-CN: 文件 <filename>/etc/apt/preferences</filename> 和 <filename>/etc/apt/preferences.d/</filename> 的参考文档在手册的 <citerefentry><refentrytitle>apt_preferences</refentrytitle><manvolnum>5</manvolnum></citerefentry>，使用 <command>man apt_preferences</command> 命令就可看到。

en: <emphasis>TIP</emphasis> Comments in <filename>/etc/apt/preferences</filename>
zh-CN: <emphasis>提示</emphasis> 在 <filename>/etc/apt/preferences</filename> 内的注释

en: <primary><literal>Explanation</literal></primary>
zh-CN: <primary><literal>解释</literal></primary>

en: There is no official syntax to put comments in the <filename>/etc/apt/preferences</filename> file, but some textual descriptions can be provided by putting one or more “<literal>Explanation</literal>” fields at the start of each entry:
zh-CN: <filename>/etc/apt/preferences</filename> 文件没有放置注释的官方语法，但可以在每个条目的 “<literal>Explanation</literal>” 字段置入若干说明：

en: Working with Several Distributions
zh-CN: 在多个发行版中工作

en: <command>apt</command> being such a marvelous tool, it is tempting to pick packages coming from other distributions. For example, after having installed a <emphasis role="distribution">Stable</emphasis> system, you might want to try out a software package available in <emphasis role="distribution">Testing</emphasis> or <emphasis role="distribution">Unstable</emphasis> without diverging too much from the system's initial state.
zh-CN: <command>apt</command> 是很奇妙的工具，可从其他发行版提取软件包。例如，安装 <emphasis role="distribution">稳定版</emphasis> 系统之后，或许想要在不偏离系统原来状态下，试试 <emphasis role="distribution">测试版</emphasis> 或 <emphasis role="distribution">不稳定版</emphasis> 的软件包。

en: Even if you will occasionally encounter problems while mixing packages from different distributions, <command>apt</command> manages such coexistence very well and limits risks very effectively. The best way to proceed is to list all distributions used in <filename>/etc/apt/sources.list</filename> (some people always put the three distributions, but remember that <emphasis role="distribution">Unstable</emphasis> is reserved for experienced users) and to define your reference distribution with the <literal>APT::Default-Release</literal> parameter (see <xref linkend="sect.apt-upgrade" />).
zh-CN: 混用不同版本软件包出问题时，即使您偶尔会在混用不同发行版的包时遇到问题，<command>apt</command> 也可以处理得极为恰当把风险降到最低。最好的方法是把所有的发行版置于 <filename>/etc/apt/sources.list</filename> 文件内 (某些人总是置入三个发行版，不过还是要记得 <emphasis role="distribution">不稳定版</emphasis> 是有经验用户的专属) 且在 <literal>APT::Default-Release</literal> 参数中设置偏好的发行版 (见 <xref linkend="sect.apt-upgrade" />) 。

en: Let's suppose that <emphasis role="distribution">Stable</emphasis> is your reference distribution but that <emphasis role="distribution">Testing</emphasis> and <emphasis role="distribution">Unstable</emphasis> are also listed in your <filename>sources.list</filename> file. In this case, you can use <command>apt install <replaceable>package</replaceable>/testing</command> to install a package from <emphasis role="distribution">Testing</emphasis>. If the installation fails due to some unsatisfiable dependencies, let it solve those dependencies within <emphasis role="distribution">Testing</emphasis> by adding the <literal>-t testing</literal> parameter. The same obviously applies to <emphasis role="distribution">Unstable</emphasis>.
zh-CN: 假设 <emphasis role="distribution">稳定版</emphasis> 是您的参考版本，但是 <emphasis role="distribution">测试版</emphasis> 与 <emphasis role="distribution">不稳定版</emphasis> 也列在 <filename>sources.list</filename> 文件内。在这个情况下，您可使用 <command>apt install <replaceable>软件包名称</replaceable>/testing</command> 安装来自 <emphasis role="distribution">测试版</emphasis> 的软件包。若因相依性未满足而安装失败，可以在 <emphasis role="distribution">测试版</emphasis> 内加入 <literal>-t testing</literal> 参数。同样的方式也适用于 <emphasis role="distribution">不稳定版</emphasis>。

en: Everything centers around the fact that APT only considers packages of higher or equal version than the installed one (assuming that <filename>/etc/apt/preferences</filename> has not been used to force priorities higher than 1000 for some packages).
zh-CN: 每件事都围绕在 APT 只处理高于或等于已安装版本号软件包的前提下 (假设 <filename>/etc/apt/preferences</filename> 还未强迫优先性高于 1000 的某些软件包)。

en: Let's assume that you have installed version 1 of a first package from <emphasis role="distribution">Stable</emphasis> and that version 2 and 3 are available respectively in <emphasis role="distribution">Testing</emphasis> and <emphasis role="distribution">Unstable</emphasis>. The installed version has a priority of 100 but the version available in <emphasis role="distribution">Stable</emphasis> (the very same) has a priority of 990 (because it is part of the target release). Packages in <emphasis role="distribution">Testing</emphasis> and <emphasis role="distribution">Unstable</emphasis> have a priority of 500 (the default priority of a non-installed version). The winner is thus version 1 with a priority of 990. The package “stays in <emphasis role="distribution">Stable</emphasis>”.
zh-CN: 假设从L <emphasis role="distribution">稳定版</emphasis> 安装第一个软件包的第一版且从 <emphasis role="distribution">测试版</emphasis> 与 <emphasis role="distribution">不稳定版</emphasis> 安装同软件包的第二版与第三版。已安装的版本优先性为 100 但在 <emphasis role="distribution">稳定版</emphasis> (相同的) 优先性为 990 (因为它是目标发布版的一部分)。在 <emphasis role="distribution">测试版</emphasis> 与 <emphasis role="distribution">不稳定版</emphasis> 的软件包其优先性为 500 (缺省不安装版本的优先性)。获选者为优先性 990 的版本1。软件包 “留在 <emphasis role="distribution">稳定版</emphasis> 内”。

en: Tracking Automatically Installed Packages
zh-CN: 自动追踪已安装的软件包

en: One of the essential functionalities of <command>apt</command> is the tracking of packages installed only through dependencies. These packages are called “automatic”, and often include libraries.
zh-CN: <command>apt</command> 的必要功能之一是经由相依性追踪已安装的软件包。这些软件包称为 “自动”，且通常包括程序库。

en: <primary>APT</primary><secondary>automatic removal</secondary>
zh-CN: <primary>APT</primary><secondary>自动移除</secondary>

en: <primary>package</primary><secondary>automatic removal</secondary>
zh-CN: <primary>软件包</primary><secondary>自动移除</secondary>

en: With this information, when packages are removed, the package managers can compute a list of automatic packages that are no longer needed (because there is no “manually installed” packages depending on them). <command>apt-get autoremove</command> or <command>apt autoremove</command> will get rid of those packages. <command>aptitude</command> does not have this command because it removes them automatically as soon as they are identified. In all cases, the tools display a clear message listing the affected packages.
zh-CN: 有了这些信息后，移除软件包时，软件包管理器可以计算不再需要的自动软件包 (因为没有 “手动安装” 软件包相依于他)。<command>apt-get autoremove</command> 或 <command>apt autoremove</command> 会清除该软件包。<command>aptitude</command> 没有这个命令，因为在标识之后会马上自动移除。在所有的情况下，清除消息中列出所有受影响的软件包。

en: It is a good habit to mark as automatic any package that you don't need directly so that they are automatically removed when they aren't necessary anymore. <command>apt-mark auto <replaceable>package</replaceable></command> will mark the given package as automatic whereas <command>apt-mark manual <replaceable>package</replaceable></command> does the opposite. <command>aptitude markauto</command> and <command>aptitude unmarkauto</command> work in the same way although they offer more features for marking many packages at once (see <xref linkend="sect.aptitude" />). The console-based interactive interface of <command>aptitude</command> also makes it easy to review the “automatic flag” on many packages.
zh-CN: 把软件包标记为自动是个好习惯，不需要时就被自动移除。<command>apt-mark auto <replaceable>软件包名称</replaceable></command> 会标记该软件包为自动而 <command>apt-mark manual <replaceable>软件包名称</replaceable></command> 则不标记。<command>aptitude markauto</command> 与 <command>aptitude unmarkauto</command> 作用相同只是功能较多 (见 <xref linkend="sect.aptitude" />)。<command>aptitude</command> 的命令交互接口也可查看多个软件包的 “自动标识”。

en: People might want to know why an automatically installed package is present on the system. To get this information from the command line, you can use <command>aptitude why <replaceable>package</replaceable></command> (<command>apt</command> and <command>apt-get</command> have no similar feature):
zh-CN: 人们可能希望知道为什么自动安装软件包出现在系统内。由于从命令行取得该等信息，可使用 <command>aptitude why <replaceable>软件包名称</replaceable></command> (<command>apt</command> 与 <command>apt-get</command> 没有类似的功能)：

en: <emphasis>ALTERNATIVE</emphasis> <command>deborphan</command> and <command>debfoster</command>
zh-CN: <emphasis>其他</emphasis> <command>deborphan</command> 与 <command>debfoster</command>

en: In days where <command>apt</command>, <command>apt-get</command> and <command>aptitude</command> were not able to track automatic packages, there were two utilities producing lists of unnecessary packages: <command>deborphan</command> and <command>debfoster</command>. Both can still be useful.
zh-CN: 早年 <command>apt</command>、<command>apt-get</command> 与 <command>aptitude</command> 还不能追踪自动软件包时，以另外两个指令产不必要软件包清单：<command>deborphan</command> 与 <command>debfoster</command>。

en: <command>debfoster</command> has a more elaborate approach, very similar to APT's one: it maintains a list of packages that have been explicitly installed, and remembers what packages are really required between each invocation. If new packages appear on the system and if <command>debfoster</command> doesn't know them as required packages, they will be shown on the screen together with a list of their dependencies. The program then offers a choice: remove the package (possibly together with those that depend on it), mark it as explicitly required, or ignore it temporarily.
zh-CN: <command>debfoster</command> 还有其他用法，极类似 APT：维护一个已安装的软件包以及需要互调用的软件包清单。系统内出现新的软件包且 <command>debfoster</command> 不知道它需要那些软件包，则在屏幕显示其相依的软件包清单。此程序提供新的选择：移除软件包 (或许连同相依者)，标记为必要，或暂时忽略它。

en: The <command>apt-cache</command> Command
zh-CN: The <command>apt-cache</command> 命令

en: <primary>APT</primary><secondary>package search</secondary>
zh-CN: <primary>APT</primary><secondary>软件包搜索</secondary>

en: <primary>APT</primary><secondary>header display</secondary>
zh-CN: <primary>APT</primary><secondary>显示标头</secondary>

en: <primary>search of packages</primary>
zh-CN: <primary>搜索软件包</primary>

en: <primary>package</primary><secondary>search</secondary>
zh-CN: <primary>软件包</primary><secondary>搜索</secondary>

en: The <command>apt-cache</command> command can display much of the information stored in APT's internal database. This information is a sort of cache since it is gathered from the different sources listed in the <filename>sources.list</filename> file. This happens during the <command>apt update</command> operation.
zh-CN: <command>apt-cache</command> 命令可显示 APT 内部数据库里的多种信息。这些信息是从 <filename>sources.list</filename> 文件内聚集不同来源的缓存。于运行 <command>apt update</command> 运作时产生的。

en: <emphasis>VOCABULARY</emphasis> Cache
zh-CN: <emphasis>术语</emphasis> 缓存

en: <primary>cache</primary>
zh-CN: <primary>缓存</primary>

en: A cache is a temporary storage system used to speed up frequent data access when the usual access method is expensive (performance-wise). This concept can be applied in numerous situations and at different scales, from the core of microprocessors up to high-end storage systems.
zh-CN: 缓存是一种暂存系统，当常用访问方法昂贵 (性能方面) 时，用于加快常用数据的取用速度。这个概念应用范围极广，从微处理器核心至高端保存系统。

en: On the other hand, it is mandatory to run <command>apt update</command> regularly to update the cache. Otherwise your package search results will always miss the latest updates distributed by the Debian mirrors.
zh-CN: 另一方面，必须运行 <command>apt update</command> 更新缓存。否则您的搜索结果会错过Debian镜像站发行版的最新更新。

en: <emphasis>ALTERNATIVE</emphasis> <command>axi-cache</command>
zh-CN: <emphasis>其他</emphasis> <command>axi-cache</command>

en: <command>apt-cache search</command> is a very rudimentary tool, basically implementing <command>grep</command> on package's descriptions. It often returns too many results or none at all when you include too many keywords.
zh-CN: <command>apt-cache search</command> 是基础的工具，使用 <command>grep</command> 搜索软件包描述。输入过多键词可能返回大量结果或完全无数据。

en: <command>axi-cache search <replaceable>term</replaceable></command>, on the other hand, provides better results, sorted by relevancy. It uses the <emphasis>Xapian</emphasis> search engine and is part of the <emphasis role="pkg">apt-xapian-index</emphasis> package which indexes all package information (and more, like the <filename>.desktop</filename> files from all Debian packages). It knows about tags (see sidebar <xref linkend="sidebar.debtags" />) and returns results in a matter of milliseconds.
zh-CN: <command>axi-cache search <replaceable>trem</replaceable></command>，从另一方面来说提供更好的结果，以相关性排序。使用 <emphasis>Xapian</emphasis> 搜索引擎且它是 <emphasis role="pkg">apt-xapian-index</emphasis> 软件包的一部分索引所有软件包的信息 (进一步来说，就像是来自所有 Debian 软件包的 <filename>.desktop</filename> 档)。显示标签 (见专栏 <xref linkend="sidebar.debtags" />) 并在毫秒之间送回结果。

en: <command>apt-cache policy</command> can also show the pinning priorities for all available versions and sources of a given package.
zh-CN: <command>apt-cache policy</command> 可以显示指定软件包所有可用版本的固定优先级和源。

en: The <command>apt-file</command> Command
zh-CN: <command>apt-file</command> 命令

en: <primary>APT</primary><secondary>file search</secondary>
zh-CN: <primary>APT</primary><secondary>文件搜索</secondary>

en: <primary>search of files</primary>
zh-CN: <primary>搜索文件</primary>

en: <primary>package</primary><secondary>search files</secondary>
zh-CN: <primary>软件包</primary><secondary>搜索文件</secondary>

en: After the database has been updated, the command <command>apt-file search <replaceable>pattern</replaceable></command> will list all packages, which contain a filename or path containing the pattern.
zh-CN: 数据库更新后，命令 <command>apt-file search <replaceable>pattern</replaceable></command> 会列出包含文件名或模式匹配的所有软件包。

en: The command <command>apt-file list <replaceable>package</replaceable></command> will list all files shipped with the package instead.
zh-CN: 命令 <command>apt-file list <replaceable>package</replaceable></command> 会列出软件包附带的所有文件。

en: <emphasis>TIP</emphasis> Listing a package contents and finding a file's package
zh-CN: <emphasis>秘诀</emphasis> 列出软件包内容和查找文件对应的软件包

en: Similar to <command>apt-file list</command> the command <command>dpkg -L <replaceable>package</replaceable></command> lists all files, but only for an installed package. To find the package, a local file belongs to, use <command>dpkg -S <replaceable>file</replaceable></command> (see <xref linkend="sect.dpkg-list" />). To list all local files not belonging to any installed package, you might want to take a look at the <emphasis role="pkg">cruft</emphasis> or the <emphasis role="pkg">cruft-ng</emphasis> package.
zh-CN: 与 <command>apt-file list</command> 类似，命令 <command>dpkg -L <replaceable>package</replaceable></command> 列出已安装软件包的所有文件。要查找属于软件包的本地文件，使用 <command>dpkg -S <replaceable>file</replaceable></command> （参阅 <xref linkend="sect.dpkg-list" />）。要列出不属于任何已安装软件包的本地文件，可以参考 <emphasis role="pkg">cruft</emphasis> 或 <emphasis role="pkg">cruft-ng</emphasis> 软件包。

en: Frontends: <command>aptitude</command>, <command>synaptic</command>
zh-CN: 前端：<command>aptitude</command>、<command>synaptic</command>

en: <primary>APT</primary><secondary>interfaces</secondary>
zh-CN: <primary>APT</primary><secondary>接口</secondary>

en: <primary>APT</primary><secondary>interfaces</secondary><tertiary><command>aptitude</command></tertiary><see><command>aptitude</command></see>
zh-CN: <primary>APT</primary><secondary>接口</secondary><tertiary><command>aptitude</command></tertiary><see><command>aptitude</command></see>

en: <command>aptitude</command> is an interactive program that can be used in semi-graphical mode on the console. You can browse the list of installed and available packages, look up all the available information, and select packages to install or remove. The program is designed specifically to be used by administrators, so that its default behaviors are designed to be much more intelligent than <command>apt-get</command>'s, and its interface much easier to understand.
zh-CN: <command>aptitude</command> 是交互程序，可用于终端机的半图形模式，可浏览已安装与可用软件包，搜索所有可用信息，并选择安装或移除的软件包。此程序专为管理者而设计，缺省的行为比 <command>apt-get</command> 的行为更智能，且其界面更容易理解。

en: The <command>aptitude</command> package manager
zh-CN: <command>aptitude</command> 软件包管理器

en: <primary><command>aptitude</command></primary><secondary>basic usage</secondary>
zh-CN: <primary><command>aptitude</command></primary><secondary>基本使用</secondary>

en: When it starts, <command>aptitude</command> shows a list of packages sorted by state (installed, non-installed, or installed but not available on the mirrors — other sections display tasks, virtual packages, and new packages that appeared recently on mirrors). To facilitate thematic browsing, other views are available. In all cases, <command>aptitude</command> displays a list combining categories and packages on the screen. Categories are organized through a tree structure, whose branches can respectively be unfolded or closed with the <keycombo><keycap>Enter</keycap></keycombo>, <keycombo><keycap>[</keycap></keycombo> and <keycombo><keycap>]</keycap></keycombo> keys. <keycombo><keycap>+</keycap></keycombo> should be used to mark a package for installation, <keycombo><keycap>-</keycap></keycombo> to mark it for removal and <keycombo><keycap>_</keycap></keycombo> to purge it (note that these keys can also be used for categories, in which case the corresponding actions will be applied to all the packages of the category). <keycombo><keycap>u</keycap></keycombo> updates the lists of available packages and <keycombo action="simul"><keycap>Shift</keycap><keycap>u</keycap></keycombo> prepares a global system upgrade. <keycombo><keycap>g</keycap></keycombo> switches to a summary view of the requested changes (and typing <keycombo><keycap>g</keycap></keycombo> again will apply the changes), and <keycombo><keycap>q</keycap></keycombo> quits the current view. If you are in the initial view, this will effectively close <command>aptitude</command>.
zh-CN: 开始的时候，<command>aptitude</command> 依状态显示所有的软件包 (已安装、未安装、或已安装但不在镜像站 — 其他的区块显示工作、虚拟软件包、与最近才出现在镜像站的新软件包)。还有其他的查看方法，提供主题式浏览。所有的情况下，<command>aptitude</command> 在屏幕显示各主题与软件包的清单。以树状组织主题，可以用 <keycombo><keycap>Enter</keycap></keycombo>、<keycombo><keycap>[</keycap></keycombo> 与 <keycombo><keycap>]</keycap></keycombo> 按键展开与收起分支。<keycombo><keycap>+</keycap></keycombo> 标示可安装的软件包，<keycombo><keycap>-</keycap></keycombo> 标示可移除的软件包，<keycombo><keycap>_</keycap></keycombo> 标示可清除的软件包 (这些按键也可用类别，对应的行为适用于类别内的所有软件包)。<keycombo><keycap>u</keycap></keycombo> 更新可用软件包清单，<keycombo action="simul"><keycap>Shift</keycap><keycap>u</keycap></keycombo> 准备全系统的更新。<keycombo><keycap>g</keycap></keycombo> 切换摘要查看模式(再次键入 <keycombo><keycap>g</keycap></keycombo> 则应用更改)，<keycombo><keycap>q</keycap></keycombo> 离开现在的视图。若您在初始的视图，将关闭 <command>aptitude</command>。

en: <emphasis>DOCUMENTATION</emphasis> <command>aptitude</command>
zh-CN: <emphasis>文档</emphasis> <command>aptitude</command>

en: <primary><command>aptitude</command></primary><secondary>documentation</secondary>
zh-CN: <primary><command>aptitude</command></primary><secondary>文档</secondary>

en: This section does not cover the finer details of using <command>aptitude</command>. It rather focuses on giving you a survival kit to use it. But it is well documented and we advise you to use its complete manual available in the <emphasis role="pkg">aptitude-doc-en</emphasis> package (see <filename>/usr/share/doc/aptitude/html/en/index.html</filename>) or at <ulink url="https://www.debian.org/doc/manuals/aptitude/" />.
zh-CN: 此区域不包括使用 <command>aptitude</command> 的详情。只专注于提供急救用的工具包。其文档较完整，建议您使用 <emphasis role="pkg">aptitude-doc-en</emphasis> 软件包内的完整手册 (见 <filename>/usr/share/doc/aptitude/html/en/index.html</filename>)或 <ulink url="https://www.debian.org/doc/manuals/aptitude/" />。

en: <primary><command>aptitude</command></primary><secondary>package search</secondary>
zh-CN: <primary><command>aptitude</command></primary><secondary>软件包搜索</secondary>

en: To search for a package, you can type <keycombo><keycap>/</keycap></keycombo> followed by a search pattern. This pattern matches the name of the package, but can also be applied to the description (if preceded by <literal>~d</literal>), to the section (with <literal>~s</literal>) or to other characteristics detailed in the documentation. The same patterns can filter the list of displayed packages: type the <keycombo><keycap>l</keycap></keycombo> key (as in <foreignphrase>limit</foreignphrase>) and enter the pattern.
zh-CN: 键入 <keycombo><keycap>/</keycap></keycombo> 及搜索的关键词，就能搜索软件包。关键词对应软件包的名称，也可以是用于描述内容 (若前置 <literal>~d</literal>、区域 (前置 <literal>~s</literal>) 或文档内的其他字词。同样地关键词可以筛选显示软件包的清单：键入 <keycombo><keycap>l</keycap></keycombo> (如同在 <foreignphrase>limit</foreignphrase> 之内) 与其他关键词。

en: <primary><command>aptitude</command></primary><secondary>automatic flag</secondary>
zh-CN: <primary><command>aptitude</command></primary><secondary>自动标记</secondary>

en: <emphasis>TOOL</emphasis> Using <command>aptitude</command> on the command-line interface
zh-CN: <emphasis>工具</emphasis> 在命令行界面使用 <command>aptitude</command>

en: <primary><command>aptitude</command></primary><secondary>command line</secondary>
zh-CN: <primary><command>aptitude</command></primary><secondary>命令行</secondary>

en: Most of <command>aptitude</command>'s features are accessible via the interactive interface as well as via command-lines. These command-lines will seem familiar to regular users of <command>apt-get</command> and <command>apt-cache</command>.
zh-CN: 经由命令行或交互界面可以使用 <command>aptitude</command> 大部分的功能。命令行看来像是 <command>apt-get</command> 与 <command>apt-cache</command>。

en: The advanced features of <command>aptitude</command> are also available on the command-line. You can use the same package search patterns as in the interactive version. For example, if you want to cleanup the list of “manually installed” packages, and if you know that none of the locally installed programs require any particular libraries or Perl modules, you can mark the corresponding packages as automatic with a single command:
zh-CN: 也能从命令行使用 <command>aptitude</command> 的高端功能。使用交互版相同的软件包搜索模式。例如，清除 “手动安装” 软件包、本地安装的程序不再需要程序库或 Perl 模块，就可把对应的软件包标示为自动：

en: Here, you can clearly see the power of the search pattern system of <command>aptitude</command>, which enables the instant selection of all the packages in the <literal>libs</literal> and <literal>perl</literal> sections.
zh-CN: 从这里您可看到 <command>aptitude</command> 搜索模式系统的威力，即时选取 <literal>libs</literal> 与 <literal>perl</literal> 区块的所有软件包。

en: Beware, if some packages are marked as automatic and if no other package depends on them, they will be removed immediately (after a confirmation request).
zh-CN: 小心，软件包被标记为自动且其他软件包均未相依于它们，该软件包就会被自动移除 (经过确认程序)。

en: Managing Recommendations, Suggestions and Tasks
zh-CN: 管理推荐、建议与工作

en: Another interesting feature of <command>aptitude</command> is the fact that it respects recommendations between packages while still giving users the choice not to install them on a case by case basis. For example, the <emphasis role="pkg">gnome</emphasis> package recommends <emphasis role="pkg">transmission-gtk</emphasis> (among others). When you select the former for installation, the latter will also be selected (and marked as automatic if not already installed on the system). Typing <keycombo><keycap>g</keycap></keycombo> will make it obvious: <emphasis role="pkg">transmission-gtk</emphasis> appears on the summary screen of pending actions in the list of packages installed automatically to satisfy dependencies. However, you can decide not to install it by deselecting it before confirming the operations.
zh-CN: <command>aptitude</command> 另个有趣的功能是尊重软件包间的建议，但给使用以个案方式选择不安装的自由。例如，<emphasis role="pkg">gnome</emphasis> 软件包建议 <emphasis role="pkg">transmission-gtk</emphasis> (及其他选择)。选择前者安装时，后者也被选取 (若未安装在系统内则标记为自动)。键入 <keycombo><keycap>g</keycap></keycombo> 将使其更明显： <emphasis role="pkg">transmission-gtk</emphasis> 显示在满足相依性的自动安装软件包清单里的待决摘要画面。然而，在确认前可以不选择，自行决定要不要安装。

en: Note that this recommendation tracking feature does not apply to upgrades. For instance, if a new version of <emphasis role="pkg">gnome</emphasis> recommends a package that it did not recommend formerly, the package won't be marked for installation. However, it will be listed on the upgrade screen so that the administrator can still select it for installation.
zh-CN: 注意，这个推荐的追踪功能不适用于更新。例如，若新版 <emphasis role="pkg">gnome</emphasis> 推荐一个以前不推荐的软件包，那么就不会安装它。然而，还是列在屏幕，管理者仍可点击并安装它。

en: Suggestions between packages are also taken into account, but in a manner adapted to their specific status. For example, since <emphasis role="pkg">gnome</emphasis> suggests <emphasis role="pkg">empathy</emphasis>, the latter will be displayed on the summary screen of pending actions (in the section of packages suggested by other packages). This way, it is visible and the administrator can decide whether to take the suggestion into account or not. Since it is only a suggestion and not a dependency or a recommendation, the package will not be selected automatically — its selection requires a manual intervention from the user (thus, the package will not be marked as automatic).
zh-CN: 同时把软件包间的建议列入考量，但调整特别的情况。例如，自从 <emphasis role="pkg">gnome</emphasis> 建议 <emphasis role="pkg">empathy</emphasis>，后者显示在屏幕的待决区 (其他软件包的建议区)。这样子，就能看见且管理者可以决定是否把它们列入考量。毕竟只是建议而不是相依或提议，软件包仍不会被列入自动 — 需要读者的人工介入 (因此，软件包不会被标示为自动)。

en: In the same spirit, remember that <command>aptitude</command> makes intelligent use of the concept of task. Since tasks are displayed as categories in the screens of packages lists, you can either select a full task for installation or removal, or browse the list of packages included in the task to select a smaller subset.
zh-CN: 在同样的精神下，记得 <command>aptitude</command> 以智能的手法使用工作的概念。在屏幕的软件包清单中显示工作，可以安装或移除选定的完整工作，或浏览包括选定较小工作的软件包清单。

en: Better Solver Algorithms
zh-CN: 更好的解决算法

en: <emphasis>NOTE</emphasis> <command>aptitude</command>'s log
zh-CN: <emphasis>说明</emphasis> <command>aptitude</command> 的日志

en: Like <command>dpkg</command>, <command>aptitude</command> keeps a trace of executed actions in its logfile (<filename>/var/log/aptitude</filename>). However, since both commands work at a very different level, you cannot find the same information in their respective logfiles. While <command>dpkg</command> logs all the operations executed on individual packages step by step, <command>aptitude</command> gives a broader view of high-level operations like a system-wide upgrade.
zh-CN: 如同 <command>dpkg</command>，<command>aptitude</command> 追踪运行动作存在其记录档内 (<filename>/var/log/aptitude</filename>)。然而，两个命令分别在不同层次工作，各自的记录档有不同的信息。当 <command>dpkg</command> 记录对各别软件包的一步步运作，<command>aptitude</command> 则记录系统更新之类的高端运作。

en: <primary>APT</primary><secondary>interfaces</secondary><tertiary><command>synaptic</command></tertiary><see><command>synaptic</command></see>
zh-CN: <primary>APT</primary><secondary>接口</secondary><tertiary><command>synaptic</command></tertiary><see><command>synaptic</command></see>

en: <command>synaptic</command> is a graphical package manager for Debian which features a clean and efficient graphical interface based on GTK+/GNOME. Its many ready-to-use filters give fast access to newly available packages, installed packages, upgradable packages, obsolete packages and so on. If you browse through these lists, you can select the operations to be done on the packages (install, upgrade, remove, purge); these operations are not performed immediately, but put into a task list. A single click on a button then validates the operations, and they are performed in one go.
zh-CN: <command>synaptic</command> 是 Debian 的软件包图形管理器，在 GTK+/GNOME 的基础上提供清楚有效的图形接口。它以很多的立即可用筛选器提供快速添加的软件包、安装软件包、可升级软件包、过时软件包等。经由这些清单浏览，选定对软件包的工作 (安装、升级、移除、清除)；不会立即运行此等工作，但把它们放入工作清单。单键按下可运行的工作，接着就可运行。

en: <command>synaptic</command> package manager
zh-CN: <command>synaptic</command> 软件包管理器

en: Checking Package Authenticity
zh-CN: 检查软件包真实性

en: <primary>package</primary><secondary>authenticity check</secondary>
zh-CN: <primary>软件包</primary><secondary>真实性检查</secondary>

en: <primary>package</primary><secondary>seal</secondary>
zh-CN: <primary>软件包</primary><secondary>封装</secondary>

en: <primary>package</primary><secondary>signature</secondary>
zh-CN: <primary>软件包</primary><secondary>签章</secondary>

en: <primary>signature</primary><secondary>package signature</secondary>
zh-CN: <primary>签章</primary><secondary>软件包签章</secondary>

en: <primary>authentication</primary><secondary>package authentication</secondary>
zh-CN: <primary>真实性</primary><secondary>软件包真实性</secondary>

en: <primary>APT</primary><secondary>archive authentification</secondary>
zh-CN: <primary>APT</primary><secondary>验证存档</secondary>

en: Security is very important for Falcot Corp administrators. Accordingly, they need to ensure that they only install packages which are guaranteed to come from Debian with no tampering on the way. A computer cracker could try to add malicious code to an otherwise legitimate package. Such a package, if installed, could do anything the cracker designed it to do, including for instance disclosing passwords or confidential information. To circumvent this risk, Debian provides a tamper-proof seal to guarantee — at install time — that a package really comes from its official maintainer and hasn't been modified by a third party.
zh-CN: Falcot 公司的管理极重视安全。因此，他们只安装 Debian 保证无窜改的软件包。电脑怪客可能在合法的软件包内加入若干恶意代码。若安装了这种软件包，就会运行怪客要它做的事，包括泄露密码或隐私信息。为避免这个风险，Debian 有个机制在安装时避免纂改的风险，只安装来自官方维护者的软件包且未经第三方修改。

en: <emphasis>NOTE</emphasis> The future of <filename>Release</filename> and <filename>Release.gpg</filename>
zh-CN: <emphasis>注意</emphasis> <filename>Release</filename> 和 <filename>Release.gpg</filename> 的发展

en: <emphasis>IN PRACTICE</emphasis> Adding trusted keys
zh-CN: <emphasis>实务</emphasis> 添加可信任的密钥

en: <primary>trusted key</primary>
zh-CN: <primary>可信任的密钥</primary>

en: <primary>key</primary><secondary>APT's authentication keys</secondary>
zh-CN: <primary>密钥</primary><secondary>APT 的信任密钥</secondary>

en: When a third-party package source is added to the <filename>sources.list</filename> file, APT needs to be told to trust the corresponding GPG authentication key (otherwise it will keep complaining that it can't ensure the authenticity of the packages coming from that repository). The first step is of course to get the public key. More often than not, the key will be provided as a small text file, which we will call <filename>key.asc</filename> in the following examples.
zh-CN: 将第三方软件包来源加入 <filename>sources.list</filename> 文件后，必须告知 APT 信任对应的 GPG 认证密钥 (否则将继续拒绝无法确认来自该存储库的软件包)。第一步是取得公钥。多半以一个小小的纯文本档做为公钥，在下面的例子里，我们称它为 <filename>key.asc</filename>。

en: Upgrading from One Stable Distribution to the Next
zh-CN: 升级至下个稳定发行版

en: One of the best-known features of Debian is its ability to upgrade an installed system from one stable release to the next: <foreignphrase>dist-upgrade</foreignphrase> — a well-known phrase — has largely contributed to the project's reputation. With a few precautions, upgrading a computer can take as little as a few minutes, or a few dozen minutes, depending on the download speed from the package repositories.
zh-CN: Debian 知名的功能之一是可升级至下个稳定版:<foreignphrase>dist-upgrade</foreignphrase> — 知名的句子 — 相当促进 Debian 的名声。除了极少的例外，升级电脑系统只需几分钟的时间，或十来分钟，依照从软件包保存库下载的速度而定.

en: Recommended Procedure
zh-CN: 推荐的程序

en: <primary>system</primary><secondary><foreignphrase>release notes</foreignphrase></secondary>
zh-CN: <primary>系统</primary><secondary><foreignphrase>发布说明</foreignphrase></secondary>

en: Since Debian has quite some time to evolve in-between stable releases, you should read the release notes before upgrading.
zh-CN: Debian 各稳定版之间存在相当的差异，升级前应仔细阅读发布说明。

en: <emphasis>BACK TO BASICS</emphasis> Release notes
zh-CN: <emphasis>基础知识</emphasis> 发布说明

en: <primary>release notes</primary>
zh-CN: <primary>发布说明</primary>

en: The release notes for an operating system (and, more generally, for any software) are a document giving an overview of the software, with some details concerning the particularities of one version. These documents are generally short compared to the complete documentation, and they usually list the features which have been introduced since the previous version. They also give details on upgrading procedures, warnings for users of previous versions, and sometimes errata.
zh-CN: 操作系统 (更宽广的说，任何软件都在内) 的发布说明是一份描述软件概况的文档，特别关照指定的版本。相对于完整的软件文档，这些文档相当简短，通常列出前一版本之后新生成的功能。也提供升级的进程、对前一版本用户的警示、以及若干错误更正。

en: <emphasis>TIP</emphasis> Finding changed files
zh-CN: <emphasis>秘诀</emphasis> 查找更改的文件

en: The <command>debsums</command> command can check if files on the local system, which are part of an installed package, have been altered. It uses a simple hashsum algorithm and the information in <filename>/var/lib/dpkg/info/<replaceable>package</replaceable>.md5sums</filename> (see <xref linkend="sect.conffiles" />). To find all altered configuration files use <command>debsums -ec</command>. To check the whole system, use <command>debsums -c</command>.
zh-CN: <command>debsums</command> 命令可以检查本地系统中已安装软件包的文件是否更改。使用简单的哈希算法和 <filename>/var/lib/dpkg/info/<replaceable>package</replaceable>.md5sums</filename> 中的信息 (参阅 <xref linkend="sect.conffiles" />)。要查找配置文件是否更改，可以使用 <command>debsums -ec</command>。要检查整个系统，使用 <command>debsums -c</command>。

en: <emphasis>NOTE</emphasis> Repository information changes
zh-CN: <emphasis>注意</emphasis> 软件仓库信息变更

en: When a new stable version of Debian is released, some fields in the <filename>Release</filename> and <filename>InRelease</filename> files of a repository change, like the <literal>Suite</literal> field. When this happens, downloading data from the repository is declined until the change is confirmed to ensure the user is prepared for it. To confirm the change use the <literal>--allow-releaseinfo-change</literal> or <literal>--allow-releaseinfo-change-<replaceable>field</replaceable></literal> options for <command>apt-get</command> or the <literal>Acquire::AllowReleaseInfoChange</literal> configuration option.
zh-CN: 当新版本的Debian发布时，<filename>Release</filename> 和 <filename>InRelease</filename> 文件中的一些存储库字段会更改，如 <literal>Suite</literal> 字段。当出现此情况时，直到用户确认已为此做好准备，否则将拒绝从存储库下载数据。要确认更改，使用 <command>apt-get</command> 的 <literal>--allow-releaseinfo-change</literal> 或 <literal>--allow-releaseinfo-change-<replaceable>field</replaceable></literal> 选项或者 <literal>Acquire::AllowReleaseInfoChange</literal> 配置选项。

en: Handling Problems after an Upgrade
zh-CN: 处理升级后的问题

en: In spite of the Debian maintainers' best efforts, a major system upgrade isn't always as smooth as you could wish. New software versions may be incompatible with previous ones (for instance, their default behavior or their data format may have changed). Also, some bugs may slip through the cracks despite the testing phase which always precedes a Debian release.
zh-CN: 尽管 Debian 管理者已经尽力做好份内的工作，主系统的升级仍可能不如想像中顺利。软件的新版本可能无法与旧版本兼容 (例如，可能改变缺省行为或数据格式)。同时，尽管在 Debian 发布前做了详尽的测试，还是有若干漏网的错误。

en: To anticipate some of these problems, you can install the <emphasis role="pkg">apt-listchanges</emphasis> package, which displays information about possible problems at the beginning of a package upgrade. This information is compiled by the package maintainers and put in <filename>/usr/share/doc/<replaceable>package</replaceable>/NEWS.Debian</filename> files for the benefit of users. Reading these files (possibly through <emphasis role="pkg">apt-listchanges</emphasis>) should help you avoid bad surprises.
zh-CN: 要解决这些问题，可以先安装 <emphasis role="pkg">apt-listchanges</emphasis> 软件包，在软件包升级前先显示可能问题。由软件包维护者编辑的这些信息且置于 <filename>/usr/share/doc/<replaceable>软件包名</replaceable>/NEWS.Debian</filename> 文件名内，供用户参考。阅读这些文件 (可能经由 <emphasis role="pkg">apt-listchanges</emphasis>) 应有助于规避意外。

en: sometimes a patch already exists, and it is available on the bug report; you can then recompile a fixed version of the broken package locally (see <xref linkend="sect.rebuilding-package" />);
zh-CN: 有时已有补丁，并且列在错误报告内；可以本地重新编译修补破碎的软件包 (见 <xref linkend="sect.rebuilding-package" />);

en: in other cases, users may have found a workaround for the problem and shared their insights about it in their replies to the report;
zh-CN: 否则，用户可能找到另外的解决方法且在报告内分享;

en: in yet other cases, a fixed package may have already been prepared and made public by the maintainer.
zh-CN: 再不然，维护者可能已准备并公开修订软件包。

en: Depending on the severity of the bug, a new version of the package may be prepared specifically for a new revision of the stable release. When this happens, the fixed package is made available in the <literal>proposed-updates</literal> section of the Debian mirrors (see <xref linkend="sect.apt-sources.list.stable.proposed-updates" />). The corresponding entry can then be temporarily added to the <filename>sources.list</filename> file, and updated packages can be installed with <command>apt</command> or <command>aptitude</command>.
zh-CN: 很严重的错误，将有特别的软件包供稳定版使用。在这种情况下，修订后的软件包位于 Debian 镜像站的 <literal>proposed-updates</literal> 区域 (见 <xref linkend="sect.apt-sources.list.stable.proposed-updates" />)。对应的条目暂时加在 <filename>sources.list</filename> 文件内，可用 <command>apt</command> 或 <command>aptitude</command> 命令安装升级软件包。

en: Sometimes the fixed package isn't available in this section yet because it is pending a validation by the Stable Release Managers. You can verify if that is the case on their web page. Packages listed there aren't available yet, but at least you know that the publication process is ongoing. <ulink type="block" url="https://release.debian.org/proposed-updates/stable.html" />
zh-CN: 修订软件包尚未被稳定版管理者认可时，就不会出现在此区块。用户必须自己动手认可它。虽然列在此的软件包尚未可得，但至少已知在审查中。<ulink type="block" url="https://release.debian.org/proposed-updates/stable.html" />

en: Cleaning Up after an Upgrade
zh-CN: 升级后的清理

en: <primary>upgrade</primary><secondary>cleaning</secondary>
zh-CN: <primary>升级</primary><secondary>清理</secondary>

en: APT usually ensures a clean upgrade, pulling in new and updated dependencies, or removing conflicting packages. But even being such a great tool, it cannot cover all tasks users and administrators will face after an upgrade, because they require a human decision.
zh-CN: APT通常保证干净升级，下载新的和更新的依赖项，或移除冲突软件包。但是，即使是如此出色的工具，也不能涵盖用户和管理员在升级后将面对的所有任务，需要人工决策。

en: Packages removed from the Debian Archive
zh-CN: 从Debian存档中删除包

en: A similar result can be achieved by <command>aptitude search ~o</command>. If the packages found are not required anymore, they should be purged from the system, because they will not face any updates for critical or security related bugs anymore.
zh-CN: 通过 <command>aptitude search ~o</command> 可以存档类似的结果。如果关键包不再需要，应该从系统中删除，因为不再有关键和安全相关问题的更新。

en: Dummy and Transitional Packages
zh-CN: 虚拟和过渡软件包

en: <primary>dummy package</primary>
zh-CN: <primary>虚拟软件包</primary>

en: <primary>transitional package</primary>
zh-CN: <primary>过渡软件包</primary>

en: <primary>package</primary><secondary>transitional</secondary>
zh-CN: <primary>软件包</primary><secondary>过渡</secondary>

en: <primary>package</primary><secondary>dummy</secondary>
zh-CN: <primary>软件包</primary><secondary>虚拟</secondary>

en: Sometimes, it might be necessary for a package to get a new name. In this case often the old package is kept as an (almost) empty package, depending on the new one and installing only the mandatory files in <filename>/usr/share/doc/<replaceable>package</replaceable>/</filename>. Such packages are called "dummy" or "transitional" packages. If the package maintainer in charge also changed the section of this package to <literal>oldlibs</literal>, then tools like <command>aptitude</command>, <command>deboprhan</command>, or <command>debfoster</command> (see sidebar <xref linkend="sidebar.deborphan-debfoster" />) can pickup these packages to suggest their removal.
zh-CN: 有时，软件包可能需要有一个新的名称。这是通常旧的软件包保留为（几乎）空的包，依赖新的软件包，并在 <filename>/usr/share/doc/<replaceable>package</replaceable>/</filename> 中安装强制文件。这些包称为"虚拟"或"过渡"软件包。如果软件包维护者将此包的区域更改为 <literal>oldlibs</literal>，则如 <command>aptitude</command>、<command>deboprhan</command> 或 <command>debfoster</command>等工具 (见侧栏 <xref linkend="sidebar.deborphan-debfoster" />)可以识别并建议删除这些包。

en: Unfortunately there is currently no foolproof way of making sure that these packages are automatically removed or picked by the tools mentioned above. One way to check if the system still has some of these packages installed, is to look through the package descriptions of installed packages and then check the results. Be careful not to schedule the results for automatic removal, because this method can lead to false positives:
zh-CN: 不幸的是，目前没有万无一失的方法确保上述工具自动删除或识别这些软件包。要检查系统是否仍安装有这些软件包的方法，是查看已安装软件包的描述并检查结果。应小心不要安排结果自动删除，因为此方法会导致误报：

en: Because the new package is pulled in as a dependency of the transitional package, it is usually marked as automatically installed and might be scheduled for removal if you try to purge the transitional package from your system. In this case you can use either of the approaches described in sidebar <xref linkend="sidebar.apt-install-and-remove" /> and <xref linkend="sect.automatic-tracking" /> to selectively remove the transitional package.
zh-CN: 因为新软件包是作为过渡软件包的依赖项安装的，通常会标记为自动安装，在尝试从系统删除过渡软件包时可能安排删除。这时可以使用侧栏 <xref linkend="sidebar.apt-install-and-remove" /> 和 <xref linkend="sect.automatic-tracking" /> 描述的方法选择性删除过渡包。

en: Old or Unused Configuration Files
zh-CN: 旧的或不再使用的配置文件

en: Files not owned by any Package
zh-CN: 不属于任何包的文件

en: The Debian policy enforces that packages don't leave files behind when they are purged. Violating this principle is a serious bug and you will rarely encounter it. If you do, report it; and if you are curious though, you can use the <emphasis role="pkg">cruft</emphasis> or <emphasis role="pkg">cruft-ng</emphasis> package to check your system for files not owned by any package.
zh-CN: Debian 原则强制软件包在删除时不能留下文件。违反原则会是一个严重错误，您很少会遇到。如果遇到此问题，请报告；如果您好奇，可以使用 <emphasis role="pkg">cruft</emphasis> 或 <emphasis role="pkg">cruft-ng</emphasis> 软件包检查系统是否由文件不属于任何软件包。

en: Keeping a System Up to Date
zh-CN: 保持系统在最新状态

en: The Debian distribution is dynamic and changes continually. Most of the changes are in the <emphasis role="distribution">Testing</emphasis> and <emphasis role="distribution">Unstable</emphasis> versions, but even <emphasis role="distribution">Stable</emphasis> is updated from time to time, mostly for security-related fixes. Whatever version of Debian a system runs, it is generally a good idea to keep it up to date, so that you can get the benefit of recent evolution and bug fixes.
zh-CN: Debian 发行版永远处于动态、持续变化中。大部分的变化在 <emphasis role="distribution">测试版</emphasis> 与 <emphasis role="distribution">不稳定版</emphasis> 中，即使是 <emphasis role="distribution">稳定版</emphasis> 也随时在更新中，主要是安全相关的修订。不论运行哪个版本，都需保持在最新的版本，才能用到最新的状态及修订错误。

en: While it is of course possible to periodically run a tool to check for available updates and run the upgrades, such a repetitive task is tedious, especially when it needs to be performed on several machines. Fortunately, like many repetitive tasks, it can be partly automated, and a set of tools have already been developed to that effect.
zh-CN: 最好定期运行升级与更新，虽然很琐碎却是必要的。幸运的是，这种重复性的工作可以自动运行，有很多工具可以使用。

en: The first of these tools is <command>apticron</command>, in the package of the same name. Its main effect is to run a script daily (via <command>cron</command>). The script updates the list of available packages, and, if some installed packages are not in the latest available version, it sends an email with a list of these packages along with the changes that have been made in the new versions. Obviously, this package mostly targets users of Debian <emphasis role="distribution">Stable</emphasis>, since the daily emails would be very long for the faster paced versions of Debian. When updates are available, <command>apticron</command> automatically downloads them. It does not install them — the administrator will still do it — but having the packages already downloaded and available locally (in APT's cache) makes the job faster.
zh-CN: 第一个工具是 <command>apticron</command>，位于同名软件包中。主要作用是每日运行一个脚本 (经由 <command>cron</command>)。这个脚本更新可用软件包清单，若已安装的软件包不在此清单内，则发送电子邮件列出该软件包清单，并指出在新版中可用的软件包。明显地，此软件包的对象是 Debian <emphasis role="distribution">稳定版</emphasis> 的用户，对其他版本的用户而言，此清单太长了。取得可更新清单后，<command>apticron</command> 自动下载它们。不会安装它们 — 那是管理者的权限与工作 — 但已下载的软件包可以本地 (于 APT 缓存内) 安装，速度快多了。

en: Administrators in charge of several computers will no doubt appreciate being informed of pending upgrades, but the upgrades themselves are still as tedious as they used to be. Periodic upgrades can be enabled: it uses a <command>systemd</command> timer unit or <command>cron</command>. If <emphasis role="pkg">systemd</emphasis> is not installed, the <filename>/etc/cron.daily/apt-compat</filename> script (in the <emphasis role="pkg">apt</emphasis> package) comes in handy. This script is run daily (and non-interactively) by <command>cron</command>. To control the behavior, use APT configuration variables (which are therefore stored in a file <filename>/etc/apt/apt.conf.d/10periodic</filename>). The main variables are:
zh-CN: 同时管理多部电脑的管理者一定很感谢被通知有待升级的软件包，但升级本身还是很繁琐的工作。可以弃用定期升级：使用 <command>systemd</command> 计时组件或 <command>cron</command>。如果 <emphasis role="pkg">systemd</emphasis> 未安装，有 <filename>/etc/cron.daily/apt-compat</filename> 脚本 (在 <emphasis role="pkg">apt</emphasis> 软件包内) 可用。此脚本是由 <command>cron</command> 每日运行 (且不是交互式)。以 APT 配置变量 (保存在 <filename>/etc/apt/apt.conf.d/10periodic</filename>中的文件) 控制其运作。主要的变量是：

en: This option allows you to specify the frequency (in days) at which the package lists are refreshed. <command>apticron</command> users can do without this variable, since <command>apticron</command> already does this task.
zh-CN: 此选项允许您指定软件包列表刷新的频率（以天计）。<command>apticron</command> 也可以在无此变量的前提下运行，因为 <command>apticron</command> 本来就已在运行中。

en: Again, this option indicates a frequency (in days), this time for the downloading of the actual packages. Again, <command>apticron</command> users won't need it.
zh-CN: 此选项指定频率 (以天计)，此时实际地下载软件包。同样地，<command>apticron</command>用户不需。

en: This option covers a feature that <command>apticron</command> doesn't have. It controls how often obsolete packages (those not referenced by any distribution anymore) are removed from the APT cache. This keeps the APT cache at a reasonable size and means that you don't need to worry about that task.
zh-CN: 此选项包括 <command>apticron</command> 没有的功能。指定过时软件包 (未被任何发行版引用) 移出 APT 缓存的时机。如此一来，APT 缓存的容量就保持在合理的范围，不必再担心其工作负担。

en: When this option is enabled, the daily script will execute <command>unattended-upgrade</command> (from the <emphasis role="pkg">unattended-upgrades</emphasis> package) which — as its name suggest — can automatize the upgrade process for some packages (by default it only takes care of security updates, but this can be customized in <filename>/etc/apt/apt.conf.d/50unattended-upgrades</filename>). Note that this option can be set with the help of debconf by running <command>dpkg-reconfigure -plow unattended-upgrades</command>. If <emphasis role="pkg">apt-listbugs</emphasis> is installed, it will prevent an automatic upgrade of packages which are affected by an already reported serious or grave bug.
zh-CN: 启用此选项后，每日脚本将执行 <command>unattended-upgrade</command>（来自 <emphasis role="pkg">unattended-upgrades</emphasis> 软件包） — 如其名称所示 — 会自动升级软件包（默认只运行安全性升级，但可以在 <filename>/etc/apt/apt.conf.d/50unattended-upgrades</filename> 中定制）。注意，这个选项能通过运行 <command>dpkg-reconfigure -plow unattended-upgrades</command> 来设置。如果安装了 <emphasis role="pkg">apt-listbugs</emphasis>，它会阻止那些被报告了严重 bug 的软件包的自动升级。

en: Other options can allow you to control the cache cleaning behavior with more precision. They are not listed here, but they are described in the <filename>/usr/lib/apt/apt.systemd.daily</filename> script.
zh-CN: 其他选项允许你更精细地控制缓存清理动作。这里未完全列出，但可以在 <filename>/usr/lib/apt/apt.systemd.daily</filename> 脚本中查看。

en: These tools work very well for servers, but desktop users generally prefer a more interactive system. The package <emphasis role="pkg">gnome-software</emphasis> provides an icon in the notification area of desktop environments when updates are available; clicking on this icon then runs an interface to perform updates. You can browse through available updates, read the short description of the relevant packages and the corresponding <filename>changelog</filename> entries, and select whether to apply the update or not on a case-by-case basis.
zh-CN: 这些工具在服务器上运作得很好，但桌面用户通常习惯于交互式系统。<emphasis role="pkg">gnome-software</emphasis> 软件包在桌面环境的通知栏提供了一个更新提示图标，点击该图标则会运行升级界面。你可以浏览可用的升级，阅读相关软件包的简短说明以及对应的 <filename>changelog</filename> 条目，逐一确认是否升级。

en: Upgrading with <command>gpk-update-viewer</command>
zh-CN: 使用 <command>gpk-update-viewer</command> 升级

en: This tool is no longer installed in the default GNOME desktop. The new philosophy is that security updates should be automatically installed, either in the background or, preferably, when you shutdown your computer so as to not confuse any running application.
zh-CN: 这个工具不再安装于默认的 GNOME 桌面中。新的哲学是安全升级应该自动安装，或者在后台安装，或者最好在你关闭计算机时，以免干扰任何正在运行的应用程序。

en: Automatic Upgrades
zh-CN: 自动升级

en: <primary>upgrade</primary><secondary>automatic system upgrade</secondary>
zh-CN: <primary>升级</primary><secondary>系统自动升级</secondary>

en: <primary>automatic upgrade</primary>
zh-CN: <primary>自动升级</primary>

en: Since Falcot Corp has many computers but only limited manpower, its administrators try to make upgrades as automatic as possible. The programs in charge of these processes must therefore run with no human intervention.
zh-CN: Falcot Corp 虽有多部电脑但人力有限，其管理者试图尽可能地自动升级。必须在无人为介入情况下处理升级事宜。

en: Configuring <command>dpkg</command>
zh-CN: 配置 <command>dpkg</command>

en: As we have already mentioned (see sidebar <xref linkend="sidebar.questions-conffiles" />), <command>dpkg</command> can be instructed not to ask for confirmation when replacing a configuration file (with the <literal>--force-confdef --force-confold</literal> options). Interactions can, however, have three other sources: some come from APT itself, some are handled by <command>debconf</command>, and some happen on the command line due to package configuration scripts (sometimes handled by <emphasis role="pkg">ucf</emphasis>).
zh-CN: 如前面提过的 (见专栏 <xref linkend="sidebar.questions-conffiles" />)，<command>dpkg</command> 可在不必确认的情况下取代原来的配置档 (以 <literal>--force-confdef --force-confold</literal> 选项运行该功能)。然而，有三个交互来源：有些来自 APT 自身、有些由 <command>debconf</command> 处理、还有的是由软件包配置脚本运行（有时由<emphasis role="pkg">ucf</emphasis>处理）。

en: Configuring APT
zh-CN: 配置 APT

en: The case of APT is simple: the <literal>-y</literal> option (or <literal>--assume-yes</literal>) tells APT to consider the answer to all its questions to be “yes”.
zh-CN: APT 的例子很简单：<literal>-y</literal> 选项 (或 <literal>--assume-yes</literal>) 告诉 APT 面对所有的问题时，答案都是 “yes”。

en: Configuring <command>debconf</command>
zh-CN: 配置 <command>debconf</command>

en: The case of <command>debconf</command> deserves more details. This program was, from its inception, designed to control the relevance and volume of questions displayed to the user, as well as the way they are shown. That is why its configuration requests a minimal priority for questions; only questions above the minimal priority are displayed. <command>debconf</command> assumes the default answer (defined by the package maintainer) for questions which it decided to skip.
zh-CN: <command>debconf</command> 需要较详细的说明。此程序原本的设计就是控制给用户看到的相关性及数量，以及显示的方法。问题需有最小的优先权；拥有最小优先权以上的问题才显示。<command>debconf</command> 缺省的答案 (由软件包维护者设置) 会略过。

en: To reconfigure <command>debconf</command>, use the <command>dpkg-reconfigure</command> tool from the <emphasis role="pkg">debconf</emphasis> package; the relevant command is <command>dpkg-reconfigure debconf</command>. Note that the configured values can be temporarily overridden with environment variables when needed (for instance, <varname>DEBIAN_FRONTEND</varname> controls the interface, as documented in the <citerefentry><refentrytitle>debconf</refentrytitle><manvolnum>7</manvolnum></citerefentry> manual page).
zh-CN: 配置 <command>debconf</command> 时，用到 <command>dpkg-reconfigure</command> 工具，它是来自 <emphasis role="pkg">debconf</emphasis> 软件包；相关的命令是 <command>dpkg-reconfigure debconf</command>。配置值可能是在需要时暂时取代的环境变量 (例如，<varname>DEBIAN_FRONTEND</varname> 控制接口，如同在 <citerefentry><refentrytitle>debconf</refentrytitle><manvolnum>7</manvolnum></citerefentry> 手册页面所述)。

en: Handling Command Line Interactions
zh-CN: 处理命令行接口

en: The last source of interactions, and the hardest to get rid of, is the configuration scripts run by <command>dpkg</command>. There is unfortunately no standard solution, and no answer is overwhelmingly better than another.
zh-CN: 最后一个交互来源，以及最难摆脱的，是 <command>dpkg</command> 运行的配置脚本。不幸的是，没有标准的解法且没有较佳的答案。

en: The common approach is to suppress the standard input by redirecting the empty content of <filename>/dev/null</filename> into it with <command><replaceable>command</replaceable> &lt;/dev/null</command>, or to feed it with an endless stream of newlines. None of these methods is 100 % reliable, but they generally lead to the default answers being used, since most scripts consider a lack of reply as an acceptance of the default value.
zh-CN: 通常的做法是，把标准的输入由空白内容的 <filename>/dev/null</filename> 文件转向给 <command><replaceable>command</replaceable> &lt;/dev/null</command>，或由新的键入字符串取代。以上的方法都不是100%可靠，但它们可以转至缺省的答案，因为大部分的脚本已考量到无默认值的答案。

en: The Miracle Combination
zh-CN: 神奇的组合

en: By combining the previous elements, it is possible to design a small but rather reliable script which can handle automatic upgrades.
zh-CN: 把前述的元素组合起来，就可能设计出一个可处理自动升级的小而可靠脚本。

en: Non-interactive upgrade script
zh-CN: 无交互升级脚本

en: <emphasis>IN PRACTICE</emphasis> The Falcot Corp case
zh-CN: <emphasis>实务</emphasis> Falcot Corp 个案

en: Falcot computers are a heterogeneous system, with machines having various functions. Administrators will therefore pick the most relevant solution for each computer.
zh-CN: Falcot 公司采用异质系统电脑，运行多种功能。管理者必须为每部电脑挑选最适合的解决方案。

en: In the lab, the few computers using <emphasis role="distribution">Testing</emphasis> — to take advantage of the latest software versions — are not upgraded automatically either. Administrators only configure APT to prepare the upgrades but not enact them; when they decide to upgrade (manually), the tedious parts of refreshing package lists and downloading packages will be avoided, and administrators can focus on the really useful part.
zh-CN: 在实验室里，有些安装 <emphasis role="distribution">测试版</emphasis> — 就是使用最新版的软件 — 的电脑也不会自动更新。管理者必须配置 APT 才能更新它们；决定更新时 (手动)，列出重新加载软件包清单并避免下载繁琐的部件，管理者就能专注在真正有用的部件。

en: Searching for Packages
zh-CN: 搜索软件包

en: <primary>package</primary><secondary>search package</secondary>
zh-CN: <primary>软件包</primary><secondary>搜索软件包</secondary>

en: The most trivial search possible is looking up an exact package name. If <command>apt show <replaceable>package</replaceable></command> returns a result, then the package exists. Unfortunately, this requires knowing or even guessing the package name, which isn't always possible.
zh-CN: 最琐碎的搜索可能是找到正确的软件包名称。若 <command>apt show <replaceable>软件包名称</replaceable></command> 返回结果，表示该软件包存在。不幸的是，必须知道或猜对软件包名称，却几乎是不可能的.

en: <emphasis>TIP</emphasis> Package naming conventions
zh-CN: <emphasis>秘诀</emphasis> 软件包命名惯例

en: <primary>package</primary><secondary>naming conventions</secondary>
zh-CN: <primary>软件包</primary><secondary>命名惯例</secondary>

en: Some categories of packages are named according to a conventional naming scheme; knowing the scheme can sometimes allow you to guess exact package names. For instance, for Perl modules, the convention says that a module called <literal>XML::Handler::Composer</literal> upstream should be packaged as <emphasis role="pkg">libxml-handler-composer-perl</emphasis>. The library enabling the use of the <command>gconf</command> system from Python is packaged as <emphasis role="pkg">python-gconf</emphasis>. It is unfortunately not possible to define a fully general naming scheme for all packages, even though package maintainers usually try to follow the choice of the upstream developers.
zh-CN: 部分类型的软件包遵循命名惯例；只要知道该惯例就能够猜到正确的软件包名称。例如，Perl 模块，惯例是名为 <literal>XML::Handler::Composer</literal> 上游的软件包名就是 <emphasis role="pkg">libxml-handler-composer-perl</emphasis>。从 Python 启用 <command>gconf</command> 系统的程序库就是软件包 <emphasis role="pkg">python-gconf</emphasis>。不幸的是即使软件包管理者努力选择上游开发者的惯例，仍无法猜中所有软件包的命名方式。

en: A slightly more successful searching pattern is a plain-text search in package names, but it remains very limited. You can generally find results by searching package descriptions: since each package has a more or less detailed description in addition to its package name, a keyword search in these descriptions will often be useful. <command>apt-cache</command> and <command>axi-cache</command> are the tools of choice for this kind of search (see <xref linkend="sidebar.apt-axi-cache" />); for instance, <command>apt-cache search video</command> will return a list of all packages whose name or description contains the keyword “video”.
zh-CN: 搜索纯文本的软件包名称，虽然有限制但成功率较高。还可以搜索软件包说明的内容：除了搜索软件包名称、关键词之外，还可搜索其说明。<command>apt-cache</command> 与 <command>axi-cache</command> 是此类搜索工具 (见 <xref linkend="sidebar.apt-axi-cache" />)；例如，<command>apt-cache search video</command> 将找出名称或说明内有键词 “video” 的软件包。

en: For more complex searches, a more powerful tool such as <command>aptitude</command> is required. <command>aptitude</command> allows you to search according to a logical expression based on the package's meta-data fields. For instance, the following command searches for packages whose name contains <literal>kino</literal>, whose description contains <literal>video</literal> and whose maintainer's name contains <literal>paul</literal>:
zh-CN: 更复杂的搜索，需要更有力的工具，如 <command>aptitude</command> 是其中之一。<command>aptitude</command> 可搜索软件包元数据字段的内容。例如，以下的范例搜索含有 <literal>kino</literal> 字样的软件包名称，其说明包括 <literal>video</literal> 与维护者名字为 <literal>paul</literal>：

en: The search only returns one package, <emphasis role="pkg">kino</emphasis>, which satisfies all three criteria.
zh-CN: 此搜索只找到一个软件包，<emphasis role="pkg">kino</emphasis>，满足全部三个条件。

en: <primary>tag</primary>
zh-CN: <primary>标签</primary>

en: <primary>package</primary><secondary>tags</secondary>
zh-CN: <primary>软件包</primary><secondary>标签</secondary>

en: Selecting the <literal>works-with::video</literal> and <literal>use::editing</literal> tags yields a handful of packages, including the <emphasis role="pkg">kino</emphasis> and <emphasis role="pkg">pitivi</emphasis> video editors. This system of classification is bound to be used more and more as time goes on, and package managers will gradually provide efficient search interfaces based on it.
zh-CN: 以 <literal>works-with::video</literal> 及 <literal>use::editing</literal> 标签可找出若干软件包，包括 <emphasis role="pkg">kino</emphasis> 与 <emphasis role="pkg">pitivi</emphasis> 影像编辑器。愈来愈多人使用这种分类系统，在此基础上，软件包管理者创建更有效的接口。

en: To sum up, the best tool for the job depends on the complexity of the search that you wish to do:
zh-CN: 总的来说，最好的工具取决于搜索时你所期望达到的复杂程度：

en: <command>apt-cache</command> only allows searching in package names and descriptions, which is very convenient when looking for a particular package that matches a few target keywords;
zh-CN: <command>apt-cache</command> 只能通过软件包名称和描述信息来进行搜索，对于搜索符合少量关键词的特定软件包十分方便;

en: when the search criteria also include relationships between packages or other meta-data such as the name of the maintainer, <command>synaptic</command> will be more useful;
zh-CN: 当搜索条件包括软件包之间的关系或者像维护者名称的其它元数据时，<command>synaptic</command> 将更加有用；

en: when a tag-based search is needed, a good tool is <command>packagesearch</command>, a graphical interface dedicated to searching available packages along several criteria (including the names of the files that they contain). For usage on the command-line, <command>axi-cache</command> will fit the bill.
zh-CN: 当需要基于标签来搜索时，<command>packagesearch</command> 是一个很好用的工具，可以根据若干条件（包括软件包中包含的文件名）进行软件包搜索的图形化专用工具。命令行下则使用 <command>axi-cache</command>。

en: finally, when the searches involve complex expressions with logic operations, the tool of choice will be <command>aptitude</command>'s search pattern syntax, which is quite powerful despite being somewhat obscure; it works in both the command-line and the interactive modes.
zh-CN: 最后，当搜索涉及有逻辑操作的复杂的表达式时，首选工具为 <command>aptitude</command> 的搜索语法，尽管有点晦涩难用但功能相当强大，它有命令行和交互两种模式。
