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

en: Configuration
zh-CN: 配置

en: Localization
zh-CN: 本地化

en: Locales
zh-CN: 地区设置

en: Network
zh-CN: 网络

en: Name resolution
zh-CN: 名称解析

en: Users
zh-CN: 用户

en: Groups
zh-CN: 用户组

en: Accounts
zh-CN: 账户

en: Command-line interpreter
zh-CN: 命令行解释器

en: Printing
zh-CN: 打印

en: Kernel compiling
zh-CN: 内核编译

en: Basic Configuration: Network, Accounts, Printing...
zh-CN: 基础配置：网络，账户，打印……

en: A computer with a new installation created with <command>debian-installer</command> is intended to be as functional as possible, but many services still have to be configured. Furthermore, it is always good to know how to change certain configuration elements defined during the initial installation process.
zh-CN: 以 <command>debian-installer</command> 命令安装的电脑是尽可能的可用，但仍有若干服务需要配置。而且，了解修改初始安装进程的配置是件好事。

en: This chapter reviews everything included in what we could call the “basic configuration”: networking, language and locales, users and groups, printing, mount points, etc.
zh-CN: 这章综述我们称之为“基础配置”所包括的任何事项：网络、语言、地区、用户、用户组、打印、挂载点等。

en: Configuring the System for Another Language
zh-CN: 用其他语言进行配置

en: <primary>French localization</primary>
zh-CN: <primary>法语环境</primary>

en: If the system was installed using French, the machine will probably already have French set as the default language. But it is good to know what the installer does to set the language, so that later, if the need arises, you can change it.
zh-CN: 如果你在法语环境下安装了系统，那么默认语言可能会被设置为法语。所以你最好知道你的安装器使用的是什么语言。如果对语言有要求而又设置错误了，你可以自己进行修改。

en: <emphasis>TOOL</emphasis> The <command>locale</command> command to display the current configuration
zh-CN: <emphasis>工具</emphasis> <command>locale</command> 命令显示当前配置

en: The <command>locale</command> command lists a summary of the current configuration of various locale parameters (date format, numbers format, etc.), presented in the form of a group of standard environment variables dedicated to the dynamic modification of these settings.
zh-CN: <command>locale</command> 命令会列出当前配置的语言环境参数（比如日期格式，数字格式），以一组标准环境变量表格的形式呈现当前的语言环境变量配置。

en: Setting the Default Language
zh-CN: 设置默认语言

en: <primary>locales</primary>
zh-CN: <primary>地区</primary>

en: <primary>language</primary>
zh-CN: <primary>语言</primary>

en: A locale is a group of regional settings. This includes not only the language for text, but also the format for displaying numbers, dates, times, and monetary sums, as well as the alphabetical comparison rules (to properly account for accented characters). Although each of these parameters can be specified independently from the others, we generally use a locale, which is a coherent set of values for these parameters corresponding to a “region” in the broadest sense. These locales are usually indicated under the form, <literal><replaceable>language-code</replaceable>_<replaceable>COUNTRY-CODE</replaceable></literal>, sometimes with a suffix to specify the character set and encoding to be used. This enables consideration of idiomatic or typographical differences between different regions with a common language.
zh-CN: 一个 locale 指一系列的区域设置。它不仅包括对文字语言的设置，也包括数字、日期、时间和货币的显示格式，以及“按字母顺序排列规则”（正确地处理重音字符）。虽然这些参数可以被独立配置，我们仍建议您使用 locale 这个从地区形式最大化匹配一连贯参数的工具。这些 locales 一般以以下格式 <literal><replaceable>语言代码</replaceable>_<replaceable>城市代码</replaceable></literal>，有时后缀也在指定字符集和编码中被使用。这是考虑到同一语言在不同区域之间使用习惯和印刷差异。

en: <emphasis>CULTURE</emphasis> Character sets
zh-CN: <emphasis>文化</emphasis> 字符集

en: Historically, each locale has an associated “character set” (group of known characters) and a preferred “encoding” (internal representation for characters within the computer).
zh-CN: 历史上看，每一个 locale 都有一个相关联的字符集（一组已知的字符集）和一个特定的编码（为计算机内部的字符表达）。

en: The most popular encodings for latin-based languages were limited to 256 characters because they opted to use a single byte for each character. Since 256 characters was not enough to cover all European languages, multiple encodings were needed, and that is how we ended up with <emphasis>ISO-8859-1</emphasis> (also known as “Latin 1”) up to <emphasis>ISO-8859-15</emphasis> (also known as “Latin 9”), among others.
zh-CN: 最广泛使用的字符编码是基于拉丁字母、使用单个 byte 表达一个字符，被限制为最多256个字符。256个字符不足以覆盖所有欧洲语言，因此多编码系统非常有必要，这就是为何我们有 <emphasis>ISO-8859-1</emphasis> （即“Latin 1”）到 <emphasis>ISO-8859-15</emphasis> （即“Latin 9”）的原因。

en: Working with foreign languages often implied regular switches between various encodings and character sets. Furthermore, writing multilingual documents led to further, almost intractable problems. Unicode (a super-catalog of nearly all writing systems from all of the world's languages) was created to work around this problem. One of Unicode's encodings, UTF-8, retains all 128 ASCII symbols (7-bit codes), but handles other characters differently. Those are preceded by a specific escape sequence of a few bits, which implicitly defines the length of the character. This allows encoding all Unicode characters on a sequence of one or more bytes. Its use has been popularized by the fact that it is the default encoding in XML documents.
zh-CN: 包含外国语言的工作状态隐含着字符集和字符设置的切换。此外一个几乎无法解决的问题，如何编写一个多语言文档？ Unicode（一个几乎包括世界所有书写系统的超集）被创建用于解决该问题。其中一个 Unicode 编码， UTF-8 ，保留了全部128个 ASCII 符号（7位代码），还以不同的方式处理了其他字符。它们通过前面几个位的特定转义序列，隐式定义了字符的长度。它们允许在一个或者多个字节序列使用所有的 Unicode 字符。因为它是 XML 文件的默认编码而被广泛推广。

en: This is the encoding that should generally be used, and is thus the default on Debian systems.
zh-CN: 它是最广泛使用的编码，也是 Debian 发行版系统的默认选项。

en: The first question invites you to select “locales” to support. Selecting all English locales (meaning those beginning with “<literal>en_</literal>”) is a reasonable choice. Do not hesitate to also enable other locales if the machine will host foreign users. The list of locales enabled on the system is stored in the <filename>/etc/locale.gen</filename> file. It is possible to edit this file by hand, but you should run <command>locale-gen</command> after any modifications. It will generate the necessary files for the added locales to work, and remove any obsolete files.
zh-CN: 第一个让您回答的问题是选哪些“ locales ”来支持。选择所有英语国家（所有以<literal>en_</literal>开始的环境）是一种可能。如果主机上有外国用户，打开对应的语言环境支持不要犹豫。所有在本系统被打开支持的语言环境存储在 <filename>/etc/locale.gen</filename> 。它可以被手动编辑，但需要在你做任何改动后运行 <command>locale-gen</command> 使改动生效。该命令将创建新添加的语言环境及其关联文件并移除过期的文件。

en: <primary>environment</primary>
zh-CN: <primary>环境</primary>

en: The <emphasis role="pkg">locales-all</emphasis> package contains the precompiled locale data for all supported locales.
zh-CN: <emphasis role="pkg">locales-all</emphasis> 包含有所有支持locale的预编译local数据。

en: <emphasis>BEHIND THE SCENES</emphasis> <filename>/etc/environment</filename> and <filename>/etc/default/locale</filename>
zh-CN: <emphasis>幕后</emphasis><filename>/etc/environment</filename> 和 <filename>/etc/default/locale</filename>

en: The <filename>/etc/environment</filename> file provides the <command>login</command>, <command>gdm</command>, or even <command>ssh</command> programs with the correct environment variables to be created.
zh-CN: <filename>/etc/environment</filename> 文件为 <command>login</command> 、 <command>gdm</command>、 <command>ssh</command> 程序提供正确的环境变量。

en: The <filename>/etc/default/locale</filename> file works in a similar manner, but contains only the <varname>LANG</varname> environment variable. Thanks to this split, some PAM users can inherit a complete environment without localization. Indeed, it is generally discouraged to run server programs with localization enabled; on the other hand, localization and regional settings are recommended for programs that open user sessions.
zh-CN: <filename>/etc/default/locale</filename> 文件的工作方式非常简单，仅包含 <varname>LANG</varname> 环境变量。得益于这种分开的配置，一些 PAM 用户可以在没有本地化设置的情况下继承一个完整环境。事实上，并不鼓励启用本地化来运行服务器程序；另一方面，对于开放用户会话的程序，推荐打开本地化和地区设置。

en: Configuring the Keyboard
zh-CN: 键盘配置

en: <primary>keyboard layout</primary>
zh-CN: <primary>键盘布局</primary>

en: <primary>layout, keyboard</primary>
zh-CN: <primary> 布局，键盘</primary>

en: Even if the keyboard layout is managed differently in console and graphical mode, Debian offers a single configuration interface that works for both: it is based on debconf and is implemented in the <emphasis role="pkg">keyboard-configuration</emphasis> package. Thus the <command>dpkg-reconfigure keyboard-configuration</command> command can be used at any time to reset the keyboard layout.
zh-CN: 甚至如果键盘布局在终端和图形模式中被设置成不同， Debian 也提供了一个简单的配置让它们都工作：它基于 debconf 并由<emphasis role="pkg">keyboard-configuration</emphasis> 包实现。使用 <command>dpkg-reconfigure keyboard-configuration</command> 命令来重新设置键盘布局。

en: <primary><emphasis>console-data</emphasis></primary>
zh-CN: <primary><emphasis>终端数据</emphasis></primary>

en: <primary><emphasis>console-tools</emphasis></primary>
zh-CN: <primary><emphasis>终端工具</emphasis></primary>

en: <indexterm><primary><literal>azerty</literal></primary></indexterm>The questions are relevant to the physical keyboard layout (a standard PC keyboard in the US will be a “Generic 104 key”), then the layout to choose (generally “US”), and then the position of the AltGr key (right Alt). Finally comes the question of the key to use for the “Compose key”, which allows for entering special characters by combining keystrokes. Type successively <keycombo action="seq"><keycap>Compose</keycap><keycap>'</keycap><keycap>e</keycap></keycombo> and produce an e-acute (“é”). All these combinations are described in the <filename>/usr/share/X11/locale/en_US.UTF-8/Compose</filename> file (or another file, determined according to the current locale indicated by <filename>/usr/share/X11/locale/compose.dir</filename>).
zh-CN: <indexterm><primary><literal>azerty（一种法文键盘布局）</literal></primary></indexterm> 有关物理键盘布局（一个标准 US 键盘是 “Generic 104 key” ）的解决方式，布局选择一般的 US， AltGr 键则定位到右 Alt。最后一个，允许使用组合按键输入特殊字符的快捷键 Compose 键，先后使用 <keycombo action="seq"><keycap>Compose</keycap> <keycap>'</keycap><keycap>e</keycap></keycombo>产生一个 e-acute（“é”）。这些组合在 <filename>/usr/share/X11/locale/en_US.UTF-8/Compose</filename> 中被定义（或者其他文件，可由 <filename>/usr/share/X11/locale/compose.dir</filename> 说明）。

en: <primary><literal>Compose</literal>, key</primary>
zh-CN: <primary><literal>Compose</literal> 键</primary>

en: <primary><literal>Meta</literal>, key</primary>
zh-CN: <primary><literal> Meta </literal>键</primary>

en: <primary>key</primary><secondary><literal>Meta</literal></secondary>
zh-CN: <primary>按键</primary><secondary><literal>Meta</literal></secondary>

en: <primary>key</primary><secondary><literal>Compose</literal></secondary>
zh-CN: <primary>按键</primary><secondary><literal>Compose</literal></secondary>

en: Note that the keyboard configuration for graphical mode described here only affects the default layout; the GNOME and KDE Plasma environments, among others, provide a keyboard control panel in their preferences allowing each user to have their own configuration. Some additional options regarding the behavior of some particular keys are also available in these control panels.
zh-CN: 注意，该处说明的是默认键盘布局下图形模式的键盘设定； GNOME 和 KDE Plasma 等环境，为每一个用户提供一个键位控制面板去设置他们的喜好键位。面板中也能提供一些特殊键位的扩展选项。

en: Migrating to UTF-8
zh-CN: 迁移到 UTF-8

en: The generalization of UTF-8 encoding has been a long awaited solution to numerous difficulties with interoperability, since it facilitates international exchange and removes the arbitrary limits on characters that can be used in a document. The one drawback is that it had to go through a rather difficult transition phase. Since it could not be completely transparent (that is, it could not happen at the same time all over the world), two conversion operations were required: one on file contents, and the other on filenames. Fortunately, the bulk of this migration has been completed and we discuss it largely for reference.
zh-CN: 尽管它去除字符上的任何限制使之在文档使用上没有任何问题，促进了国际化交换 ，但是总体上 UTF-8 编码作为一个期待已久的解决方案在互通上困难重重。其中一个弊端是它必须经历一个相当困难的过渡过程。它并不能做到完全透明（这是说，它无法做到整个世界同时切换），需要两个转换操作：一个是在文件内容，一个在文件名。幸运的是大部分工作已经完成了，在更很大程度上我们讨论它作为一种参考。

en: <emphasis>CULTURE</emphasis> <foreignphrase>Mojibake</foreignphrase> and interpretation errors
zh-CN: <emphasis>文化</emphasis><foreignphrase> 乱码</foreignphrase>以及谬误

en: Thus, if a French text appears normal with the exception of accented letters and certain symbols which appear to be replaced with sequences of characters like “Ã©” or Ã¨” or “Ã§”, it is probably a file encoded as UTF-8 but interpreted as ISO-8859-1 or ISO-8859-15. This is a sign of a local installation that has not yet been migrated to UTF-8. If, instead, you see question marks instead of accented letters — even if these question marks seem to also replace a character that should have followed the accented letter — it is likely that your installation is already configured for UTF-8 and that you have been sent a document encoded in Western ISO.
zh-CN: 因此，如果一个法文文本其他字符都显示正常，但是重音字母却被像 “Ã©” or Ã¨” or “Ã§” 这样的字符取代，那么很有可能这个文件使用的编码是 UTF-8 但系统解释的时候用的是 ISO-8859-1 或者 ISO-8859-15 编码。很有可能你的本地语言环境没有转换到 UTF-8；相反，如果你看到的是一连串的问号，即使这些问号看上去像是被重音字母取代，很有可能你的本地语言系统确实配置了UTF-8，但是您获取到的是一个西方 ISO 格式编码的文档。

en: So much for “simple” cases. These cases only appear in Western culture, since Unicode (and UTF-8) was designed to maximize the common points with historical encodings for Western languages based on the Latin alphabet, which allows recognition of parts of the text even when some characters are missing.
zh-CN: 一些“简单”的例子。这些例子限定在西方文化下，Unicode（以及 UTF-8）的设计最大兼容基于拉丁语系西方语言的历史编码，允许在部分字符缺失的情况下识别部分文本。

en: In more complex configurations, which, for example, involve two environments corresponding to two different languages that do not use the same alphabet, you often get completely illegible results — a series of abstract symbols that have nothing to do with each other. This is especially common with Asian languages due to their numerous languages and writing systems. The Japanese word <foreignphrase>mojibake</foreignphrase> has been adopted to describe this phenomenon. When it appears, diagnosis is more complex and the simplest solution is often to simply migrate to UTF-8 on both sides.
zh-CN: 在较复杂的环境中，例如，使用字母表不同的两种语言，通常得到完全不同的结果 — 一系列彼此毫无关联的抽象符号。这种情况在拥有繁复语言和书写系统的亚洲语言中尤为常见。日语中的单词 <foreignphrase>mojibake</foreignphrase>（乱码）被用来描述这一现象。当这种现象出现时，诊断将非常困难。最简单的解决方案就是将两端都移植到UTF-8.

en: As far as file names are concerned, the migration can be relatively simple. The <command>convmv</command> tool (in the package with the same name) was created specifically for this purpose; it allows renaming files from one encoding to another. The use of this tool is relatively simple, but we recommend doing it in two steps to avoid surprises. The following example illustrates a UTF-8 environment containing directory names encoded in ISO-8859-15, and the use of <command>convmv</command> to rename them.
zh-CN: 就文件名而言，转换工作还算简单。<command>convmv</command>工具就是为这一场景设计的，它可以转换文件名编码。此工具的使用相对简单，但是我们推荐分两个步骤来使用，以避免意外。下例演示了一个包含ISO-8859-15编码目录名的UTF-8环境，并使用<command>convmv</command> 重命名的过程。

en: For the file content, conversion procedures are more complex due to the vast variety of existing file formats. Some file formats include encoding information that facilitates the tasks of the software used to treat them; it is sufficient, then, to open these files and re-save them specifying UTF-8 encoding. In other cases, you have to specify the original encoding (ISO-8859-1 or “Western”, or ISO-8859-15 or “Western (Euro)”, according to the formulations) when opening the file.
zh-CN: 对文件内容来说，由于既存文件格式的多样性，转换过程会更加复杂。有些文件格式本身包含编码信息帮助软件使用它们。然后，打开这些文件并以UTF-8编码重新保存即可。其它的情况则必须指定原始的编码方式 (ISO-8859-1 或 “Western”、ISO-8859-15或 “Western (Euro)”，视其规则而定) 来打开它们。

en: Configuring the Network
zh-CN: 配置网络

en: <emphasis>BACK TO BASICS</emphasis> Essential network concepts (Ethernet, IP address, subnet, broadcast)
zh-CN: <emphasis>基本知识</emphasis>必要的网络概念（以太网、IP地址、子网、广播）

en: <primary>Ethernet</primary>
zh-CN: <primary>以太网</primary>

en: <primary>connector, RJ45</primary>
zh-CN: <primary>连接器, RJ45</primary>

en: <primary>RJ45 connector</primary>
zh-CN: <primary>RJ45 连接器</primary>

en: Most modern local networks use the Ethernet protocol, where data is split into small blocks called frames and transmitted on the wire one frame at a time. Data speeds vary from 10 Mb/s for older Ethernet cards to 100 Gb/s in the newest cards (with the most common rate currently growing from 100 Mb/s to 10 Gb/s). The most widely used cables are called 10BASE-T, 100BASE-T, 1000BASE-T, 10GBASE-T and 40GBASE-T, depending on the throughput they can reliably provide (the T stands for “twisted pair”); those cables end in an RJ45 connector. There are other cable types, used mostly for speeds of 10 Gb/s and above.
zh-CN: 大多数现代网络使用以太网协议，数据被分成称为帧的小块，并在网络上一帧一帧地传输。传输速度从较古老的网卡的10Mb /s到最新网卡的100Gb /s不等(目前最常见的速率是从100Mb /s到10Gb /s)。最常使用的线缆是10BASE-T、100BASE-T、1000BASE-T、10GBASE-T和40GBASE-T，这取决于它们能够可靠提供的吞吐量(T代表“双绞线”);这些线缆两端是RJ45连接器。还有其他类型的线缆，主要用于10Gb /s以上速度的场景。

en: <primary>address, IP address</primary>
zh-CN: <primary>地址, IP地址</primary>

en: An IP address is a number used to identify a network interface on a computer on a local network or the Internet. In the currently most widespread version of IP (IPv4), this number is encoded in 32 bits, and is usually represented as 4 numbers separated by periods (e.g. <literal>192.168.0.1</literal>), each number being between 0 and 255 (inclusive, which corresponds to 8 bits of data). The next version of the protocol, IPv6, extends this addressing space to 128 bits, and the addresses are generally represented as a series of hexadecimal numbers separated by colons (e.g., 2001:0db8:13bb:0002:0000:0000:0000:0020, or 2001:db8:13bb:2::20 for short).
zh-CN: IP地址是一串数字，用来识别本地网络或Internet上计算机的网络接口。在目前使用最广泛的IPV4版本中，这串数字由32位二进制数组成，通常表示为以点分隔的4个十进制数字表示（如 <literal>192.168.0.1</literal>），每个数字介于0-255之间（包含本身，对应8位的数据）。IP的下一代版本是IPV6，采用128位二进制数规定一个地址。其地址常用冒号分隔的16进制数字书写 (如 2001:0db8:13bb:0002:0000:0000:0000:0020，或以 2001:db8:13bb:2::20 简化表示)。

en: <primary>subnet</primary>
zh-CN: <primary>子网</primary>

en: <primary>mask</primary><secondary>subnet mask</secondary>
zh-CN: <primary>掩码</primary><secondary>子网掩码</secondary>

en: A subnet mask (netmask) defines in its binary code which portion of an IP address corresponds to the network, the remainder specifying the machine. In the example of configuring a static IPv4 address given here, the subnet mask, <literal>255.255.255.0</literal> (24 “1”s followed by 8 “0”s in binary representation) indicates that the first 24 bits of the IP address correspond to the network address, and the other 8 are specific to the machine. In IPv6, for readability, only the number of “1”s is expressed; the netmask for an IPv6 network could, thus, be <literal>64</literal>.
zh-CN: 子网掩码（网络掩码）通过二进制码来定义IP地址中哪些部分对应网络，剩余部分则对应主机。在这里给出的配置静态IPv4地址的例子中，子网掩码是<literal>255.255.255.0</literal>(二进制表示是24个“1”后面跟着8个“0”)表示IP地址的前24位对应于网络地址，其他8位对应主机。在IPv6中，为了可读性，只表示数字“1”；因此，IPv6网络的掩码可以是<literal>64</literal>。

en: The network address is an IP address in which the part describing the machine's number is 0. The range of IPv4 addresses in a complete network is often indicated by the syntax, <emphasis>a.b.c.d/e</emphasis>, in which <emphasis>a.b.c.d</emphasis> is the network address and <emphasis>e</emphasis> is the number of bits affected to the network part in an IP address. The example network would thus be written: <literal>192.168.0.0/24</literal>. The syntax is similar in IPv6: <literal>2001:db8:13bb:2::/64</literal>.
zh-CN: 网络地址是主机号全为0的IP地址。一个完整网络的IP地址范围使用该语法表示：<emphasis>a.b.c.d/e</emphasis>；<emphasis>a.b.c.d</emphasis>是网络地址， <emphasis>e</emphasis>指定IP地址中网络位的长度。例如<literal>192.168.0.0/24</literal>可用于指定一个网络。IPV6的语法与之类似，示例可写作<literal>2001:db8:13bb:2::/64</literal>。

en: <primary>router</primary>
zh-CN: <primary>路由器</primary>

en: <primary>bridge</primary>
zh-CN: <primary>桥接</primary>

en: A router is a machine that connects several networks to each other. All traffic coming through a router is guided to the correct network. To do this, the router analyzes incoming packets and redirects them according to the IP address of their destination. The router is often known as a gateway; in this configuration, it works as a machine that helps reach out beyond a local network (towards an extended network, such as the Internet).
zh-CN: 路由器用来连接多个网络，所有通过路由器的流量都被引导到正确的网络。要做到这一点，路由器需要分析进入路由器的数据包，并根据目标IP地址将其重定向。路由器通常被称作网关；在这种配置下，路由器用于帮助跳出本地网络（进入外部网络，例如Internet）。

en: <primary>broadcast</primary>
zh-CN: <primary>广播</primary>

en: The special broadcast address connects all the stations in a network. Almost never “routed”, it only functions on the network in question. Specifically, it means that a data packet addressed to the broadcast never passes through the router.
zh-CN: 广播地址是一类特殊的地址，与网络中的所有主机相连。广播地址几乎从来不被“路由”，只在本地网络内发送信息。也就是说，发往广播地址的数据包从不经过路由器。

en: This chapter focuses on IPv4 addresses, since they are currently the most commonly used. The details of the IPv6 protocol are approached in <xref linkend="sect.ipv6" />, but the concepts remain the same.
zh-CN: 本章只讨论IPV4地址，因为它是目前最常用的协议。有关IPV6协议在<xref linkend="sect.ipv6" />中讨论，其概念是相同的。

en: The network is automatically configured during the initial installation. If Network Manager gets installed (which is generally the case for full desktop installations), then it might be that no configuration is actually required (for example, if you rely on DHCP on a wired connection and have no specific requirements). If a configuration is required (for example, for a WiFi interface), then it will create the appropriate file in <filename>/etc/NetworkManager/system-connections/</filename>.
zh-CN: 在初始安装时自动配置网络。如果安装了网络管理器（通常是安装完整桌面的情况），则可能实际不需要任何配置（例如，如果您依赖 DHCP 进行有线连接，并且没有特定要求）。如果需要配置（例如WiFi 接口），它将在 <filename>/etc/NetworkManager/system-connections/</filename>中创建相应的文件。

en: <emphasis>NOTE</emphasis> NetworkManager
zh-CN: <emphasis>说明</emphasis> NetworkManager

en: <primary>network</primary><secondary>configuration</secondary>
zh-CN: <primary>网络</primary><secondary>配置</secondary>

en: <primary>interface</primary><secondary>network interface</secondary>
zh-CN: <primary>接口</primary><secondary>网络接口</secondary>

en: Ethernet Interface
zh-CN: 以太网接口

en: If the computer has an Ethernet card, the IP network that is associated with it must be configured by choosing from one of two methods. The simplest method is dynamic configuration with DHCP, and it requires a DHCP server on the local network. It may indicate a desired hostname, corresponding to the <literal>hostname</literal> setting in the example below. The DHCP server then sends configuration settings for the appropriate network.
zh-CN: 电脑使用以太网卡时，必须以下列方法之一配置 IP 网络。最简单的方式是以 DHCP 动态配置，需要在本地网络有 DHCP 服务器。可能需要设置 <literal>hostname</literal> 指定主机名称。DHCP 服务器就会送出适当的网络配置。

en: DHCP configuration
zh-CN: DHCP 配置

en: <emphasis>IN PRACTICE</emphasis> Names of network interfaces
zh-CN: <emphasis>实例</emphasis> 网络接口的名称

en: Obviously, you are free to override this policy and/or to complement it to customize the names of some specific interfaces. You can find out the names of the network interfaces in the output of <command>ip addr</command> (or as filenames in <filename>/sys/class/net/</filename>).
zh-CN: 显然，您可以自已重写此规则和/或补充一些自定义的接口名称。可以在 <command>ip addr</command> 的输出 (或 <filename>/sys/class/net/</filename>中的文件名)中找到网络接口的名称。

en: A “static” configuration must indicate network settings in a fixed manner. This includes at least the IP address and subnet mask; network and broadcast addresses are also sometimes listed. A router connecting to the exterior will be specified as a gateway.
zh-CN: “静态” 配置必须以固定方式指明网络设置。至少包括 IP 网址及子网掩码；有时也列出网络及广播地址。链接外部的路由器作为网关。

en: Static configuration
zh-CN: 静态配置

en: <primary>network</primary><secondary>address</secondary>
zh-CN: <primary>网络</primary><secondary>地址</secondary>

en: <emphasis>NOTE</emphasis> Multiple addresses
zh-CN: <emphasis>说明</emphasis> 多地址

en: As you can guess, the configurations can be rather complex, but these options are only used in very special cases. The examples cited here are typical of the usual configurations.
zh-CN: 如您所想，配置可以极为复杂，不过只限于极为特殊的例子。此处引用的例子都是一般常见的配置。

en: Wireless Interface
zh-CN: 无线网络接口

en: <primary>wireless</primary>
zh-CN: <primary>无线网络</primary>

en: Getting wireless network cards to work can be a bit more challenging. First of all, they often require the installation of proprietary firmwares which are not installed by default in Debian. Then wireless networks rely on cryptography to restrict access to authorized users only, this implies storing some secret key in the network configuration. Let's tackle those topics one by one.
zh-CN: 使无线网卡工作会有一点复杂。首先，通常需要安装Debian默认未安装的合适的专有固件。然后无线网络依靠加密来限制授权用户的访问，这意味着需要在网络配置中存储一些密钥。我们一步一步讨论这些问题。

en: Installing the required firmwares
zh-CN: 安装需要的专有固件

en: <primary>firmware</primary>
zh-CN: <primary>固件</primary>

en: First you have to enable the non-free repository in APT's sources.list file: see <xref linkend="sect.apt-sources.list" /> for details about this file. Many firmware are proprietary and are thus located in this repository. You can try to skip this step if you want, but if the next step doesn't find the required firmware, retry after having enabled the non-free section.
zh-CN: 首先，需要启用APT sources.list 文件中的 non-free 仓库。有关此文件的详细说明见： <xref linkend="sect.apt-sources.list" />。许多固件是专有的，存储在此 for det仓库中。可以尝试跳过此步，但如果在下一步中找不到需要的固件，请返回启用 non-free 仓库。

en: Then you have to install the appropriate <literal>firmware-*</literal> packages. If you don't know which package you need, you can install the <emphasis role="pkg">isenkram</emphasis> package and run its <command>isenkram-autoinstall-firmware</command> command. The packages are often named after the hardware manufacturer or the corresponding kernel module: <emphasis role="pkg">firmware-iwlwifi</emphasis> for Intel wireless cards, <emphasis role="pkg">firmware-atheros</emphasis> for Qualcomm Atheros, <emphasis role="pkg">firmware-ralink</emphasis> for Ralink, etc. A reboot is then recommended because the kernel driver usually looks for the firmware files when it is first loaded and no longer afterwards.
zh-CN: 然后，需要安装适当的 <literal>firmware-*</literal> 包。如果您不清楚需要哪个包，可以安装 <emphasis role="pkg">isenkram</emphasis> 包，然后运行 <command>isenkram-autoinstall-firmware</command> 命令。这些包通常以硬件制造商或相应内核模块命名：Intel无线网卡是 <emphasis role="pkg">firmware-iwlwifi</emphasis>，Qualcomm Atheros 无线网卡是 <emphasis role="pkg">firmware-atheros</emphasis>，Ralink无线网卡是 <emphasis role="pkg">firmware-ralink</emphasis>，等等。建议重启计算机，因为内核驱动通常在第一次加载时查找固件文件，且之后不再执行。

en: Wireless specific entries in <filename>/etc/network/interfaces</filename>
zh-CN: 在 <filename>/etc/network/interfaces</filename> 中启用条目

en: <emphasis>ifupdown</emphasis> is able to manage wireless interfaces but it needs the help of the <emphasis role="pkg">wpasupplicant</emphasis> package which provides the required integration between <emphasis>ifupdown</emphasis> and the <command>wpa_supplicant</command> command used to configure the wireless interfaces (when using WPA/WPA2 encryption). The usual entry in <filename>/etc/network/interfaces</filename> needs to be extended with two supplementary parameters to specify the name of the wireless network (aka its SSID) and the <emphasis>Pre-Shared Key</emphasis> (PSK).
zh-CN: <emphasis>ifupdown</emphasis> 能够管理无线网络接口，但仍需要 <emphasis role="pkg">wpasupplicant</emphasis> 包帮助连接，该包提供 <emphasis>ifupdown</emphasis> 管理无线网络接口需要的 <command>wpa_supplicant</command> 命令（使用 WPA/WPA2 加密时）。通常需要在 <filename>/etc/network/interfaces</filename> 中的条目添加两个扩展参数来指定无线网络的名称（也称为 SSID）和 <emphasis>预共享密钥</emphasis> (PSK)。

en: DHCP configuration for a wireless interface
zh-CN: 无线网络接口的DHCP配置

en: The <literal>wpa-psk</literal> parameter can contain either the plain text passphrase or its hashed version generated with <command>wpa_passphrase <replaceable>SSID</replaceable> <replaceable>passphrase</replaceable></command>. If you use an unencrypted wireless connection, then you should put a <literal>wpa-key-mgmt NONE</literal> and no <literal>wpa-psk</literal> entry. For more information about the possible configuration options, have a look at <filename>/usr/share/doc/wpasupplicant/README.Debian.gz</filename>.
zh-CN: <literal>wpa-psk</literal> 参数包含纯文本密码短语或使用 <command>wpa_passphrase <replaceable>SSID</replaceable> <replaceable>passphrase</replaceable></command> 生成的哈希版本。如果使用未加密的无线连接，则应输入 <literal>wpa-key-mgmt NONE</literal> 及不要使用 <literal>wpa-psk</literal> 条目。关于可用配置的详细信息，请参阅 <filename>/usr/share/doc/wpasupplicant/README.Debian.gz</filename>。

en: At this point, you should consider restricting the read permissions on <filename>/etc/network/interfaces</filename> to the root user only since the file contains a private key that not all users should have access to.
zh-CN: 此时，应将 <filename>/etc/network/interfaces</filename> 的读取权限限制为root用户，因为其中包含不是所有用户可以访问的私钥。

en: <emphasis>HISTORY</emphasis> WEP encryption
zh-CN: <emphasis>历史</emphasis> WEP加密

en: Usage of the deprecated WEP encryption protocol is possible with the <emphasis role="pkg">wireless-tools</emphasis> package. See <filename>/usr/share/doc/wireless-tools/README.Debian</filename> for instructions.
zh-CN: 使用 <emphasis role="pkg">wireless-tools</emphasis> 包可以使用已弃用的WEP加密协议。请参阅 <filename>/usr/share/doc/wireless-tools/README.Debian</filename>。

en: Connecting with PPP through a PSTN Modem
zh-CN: 经由 PSTN 调制解调器的 PPP 链接

en: <primary>point to point</primary>
zh-CN: <primary>点对点</primary>

en: <primary>connection</primary><secondary>by PSTN modem</secondary>
zh-CN: <primary>链接</primary><secondary>经由 PSTN 调制解调器</secondary>

en: <primary>modem</primary><secondary>PSTN</secondary>
zh-CN: <primary>调制解调器</primary><secondary>PSTN</secondary>

en: A point to point (PPP) connection establishes an intermittent connection; this is the most common solution for connections made with a telephone modem (“PSTN modem”, since the connection goes over the public switched telephone network).
zh-CN: 点对点 (PPP) 链接创建断续的链接；这是电话调制解调器最常见的链接方式 (“PSTN 调制解调器”，经由公共交换电话网络)。

en: A connection by telephone modem requires an account with an access provider, including a telephone number, username, password, and, sometimes the authentication protocol to be used. Such a connection is configured using the <command>pppconfig</command> tool in the Debian package of the same name. By default, it sets up a connection named <literal>provider</literal> (as in Internet service provider). When in doubt about the authentication protocol, choose <emphasis>PAP</emphasis>: it is offered by the majority of Internet service providers.
zh-CN: 电话调制解调器需要帐号才能链接，包括电话号码、用户名、密码、以及认证协定。这种链接 Debian 使用同名软件包 里的 <command>pppconfig</command> 工具。缺省使用的名称是 <literal>provider</literal> (作为互联网服务提供者)。对认证协定有疑义时，选择 <emphasis>PAP</emphasis>：大多数互联网服务提供者使用它。

en: After configuration, it is possible to connect using the <command>pon</command> command (giving it the name of the connection as a parameter, when the default value of <literal>provider</literal> is not appropriate). The link is disconnected with the <command>poff</command> command. These two commands can be executed by the root user, or by any other user, provided they are in the <literal>dip</literal> group.
zh-CN: 配置之后，就可以使用 <command>pon</command> 命令 (<literal>provider</literal> 的默认值不适用时，将链接的名称当成参数)。以 <command>poff</command> 命令断线。这两个令可以由root用户或者在 <literal>dip</literal> 群组的其他用户运行。

en: Connecting through an ADSL Modem
zh-CN: 以 ADSL 调制解调器链接

en: <primary>connection</primary><secondary>by ADSL modem</secondary>
zh-CN: <primary>链接</primary><secondary>经由 ADSL 调制解调器</secondary>

en: <primary>modem</primary><secondary>ADSL</secondary>
zh-CN: <primary>调制解调器</primary><secondary>ADSL</secondary>

en: <primary>ADSL, modem</primary>
zh-CN: <primary>ADSL，调制解调器</primary>

en: The generic term “ADSL modem” covers a multitude of devices with very different functions. The modems that are simplest to use with Linux are those that have an Ethernet interface (and not only a USB interface). These tend to be popular; most ADSL Internet service providers lend (or lease) a “box” with Ethernet interfaces. Depending on the type of modem, the configuration required can vary widely.
zh-CN: “ADSL 调制解调器” 一词包括不同功能的多种设备。Linux 使用的调制解调器有以太网接口 (不只是 USB 接口)。这是极为普遍的调制解调器；大部份的 ADSL 互联网服务商出借 (或出租) 一个含以太网接口的 “盒子”。视其类型而有不同的设置。

en: Modems Supporting PPPOE
zh-CN: 支持 PPPOE 的调制解调器

en: Some Ethernet modems work with the PPPOE protocol (Point to Point Protocol over Ethernet). The <command>pppoeconf</command> tool (from the package with the same name) will configure the connection. To do so, it modifies the <filename>/etc/ppp/peers/dsl-provider</filename> file with the settings provided and records the login information in the <filename>/etc/ppp/pap-secrets</filename> and <filename>/etc/ppp/chap-secrets</filename> files. It is recommended to accept all modifications that it proposes.
zh-CN: 部份以太网调制解调器使用 PPPOE 协议 (以太网上的对等协议)。<command>pppoeconf</command> 工具 (位于同名软件包内) 将配置其链接。为此，它修改 <filename>/etc/ppp/peers/dsl-provider</filename> 文件提供的并记录在 <filename>/etc/ppp/pap-secrets</filename> 与 <filename>/etc/ppp/chap-secrets</filename> 文件的内容。建议全盘接纳所有的建议。

en: Once this configuration is complete, you can open the ADSL connection with the command, <command>pon dsl-provider</command> and disconnect with <command>poff dsl-provider</command>.
zh-CN: 配置完成之后，以命令 <command>pon dsl-provider</command> 开启 ADSL 链接，并以命令 <command>poff dsl-provider</command> 断线。

en: <emphasis>TIP</emphasis> Starting <command>ppp</command> at boot
zh-CN: <emphasis>提示</emphasis>开机时启动 <command>ppp</command>

en: PPP connections over ADSL are, by definition, intermittent. Since they are usually not billed according to time, there are few downsides to the temptation of keeping them always open. The standard means to do so is to use the init system.
zh-CN: PPP 在 ADSL 上的链接，其定义是间歇性的。因为通常不是按照连接时间收费，因此保持始终连接没有坏处。这样做的标准方法是使用 init 系统。

en: With systemd, adding an automatically restarting task for the ADSL connection is a simple matter of creating a “unit file” such as <filename>/etc/systemd/system/adsl-connection.service</filename>, with contents such as the following:
zh-CN: 使用 systemd 时，为ADSL连接添加自动重新启动任务的方法是创建 “单元文件”，如 <filename>/etc/systemd/system/adsl-connection.service</filename>，内容如下：

en: Once this unit file has been defined, it needs to be enabled with <command>systemctl enable adsl-connection</command>. Then the loop can be started manually with <command>systemctl start adsl-connection</command>; it will also be started automatically on boot.
zh-CN: 设置这个单元文件之后，还需以 <command>systemctl enable adsl-connection</command> 命令启动它。然后用命令 <command>systemctl start adsl-connection</command> 以手动方式启动；在开机时可自动启动。

en: On systems not using <command>systemd</command> (including <emphasis role="distribution">Wheezy</emphasis> and earlier versions of Debian), the standard SystemV init works differently. On such systems, all that is needed is to add a line such as the following at the end of the <filename>/etc/inittab</filename> file; then, any time the connection is disconnected, <command>init</command> will reconnect it.
zh-CN: 在未使用 <command>systemd</command> 的系统中 (包括 <emphasis role="distribution">Wheezy</emphasis> 及更早版本的 Debian)，可使用标准的 SystemV init。在这种系统里，只需在 <filename>/etc/inittab</filename> 文件加入一行；然后，在断线之后，运行 <command>init</command> 就可重新连接。

en: For ADSL connections that auto-disconnect on a daily basis, this method reduces the duration of the interruption.
zh-CN: 每天自动断线的 ADSL，使用这种方法可以减少中断的次数。

en: Modems Supporting PPTP
zh-CN: 支持 PPTP 的调制解调器

en: The PPTP (Point-to-Point Tunneling Protocol) protocol was created by Microsoft. Deployed at the beginning of ADSL, it was quickly replaced by PPPOE. If this protocol is forced on you, see <xref linkend="sect.pptp" />.
zh-CN: PPTP (点对点隧道协议) 协议由微软创制。部署在 ADSL 的初期，很快就被 PPPOE 取代。若被强制使用此协议，请参见 <xref linkend="sect.pptp" />。

en: Modems Supporting DHCP
zh-CN: 支持 DHCP 的调制解调器

en: When a modem is connected to the computer by an Ethernet cable (crossover cable) you typically configure a network connection by DHCP on the computer; the modem automatically acts as a gateway by default and takes care of routing (meaning that it manages the network traffic between the computer and the Internet).
zh-CN: 用以太网缆线 (交叉网线) 连接电脑的调制解调器，可以在电脑以 DHCP 配置网络链接；调制解调器自动成为网关且运行路由的功能 (就是管理电脑与互联网的流量)。

en: <emphasis>BACK TO BASICS</emphasis> Crossover cable for a direct Ethernet connection
zh-CN: <emphasis>基础知识</emphasis> 直接链接以太网的交叉网线

en: <primary>crossover cable</primary>
zh-CN: <primary>交叉网线</primary>

en: Computer network cards expect to receive data on specific wires in the cable, and send their data on others. When you connect a computer to a local network, you usually connect a cable (straight or crossover) between the network card and a repeater or switch. However, if you want to connect two computers directly (without an intermediary switch or repeater), you must route the signal sent by one card to the receiving side of the other card, and vice-versa. This is the purpose of a crossover cable, and the reason it is used.
zh-CN: 电脑网卡经由特定缆线接收数据，也从同样的管道送出数据。电脑连上本地网络后，通常以缆线 (直连网线或交叉网线) 连接网络上的集线器或交换器。若想直接连接两部电脑 (不经过交换器或集线器)，必须经由网卡送出数据至接收端的另个网络卡，反之亦然。这就是交叉网线的作用，以及使用它的原因。

en: Note that this distinction has become almost irrelevant over time, as modern network cards are able to detect the type of cable present and adapt accordingly, so it won't be unusual that both kinds of cable will work in a given location.
zh-CN: 请注意，随着时间的推移，这种区别几乎变得无关紧要，因为现代网卡能够检测并相应地调整电缆的类型，因此这两种电缆在同一位置工作并不罕见。

en: Most “ADSL routers” on the market can be used like this, as do most of the ADSL modems provided by Internet services providers.
zh-CN: 大部份的 “ADSL 路由器” 也能这么做，互联网服务供应商提供的 ADSL 调制解调器也具有此功能。

en: Automatic Network Configuration for Roaming Users
zh-CN: 漫游用户的网络自动配置

en: <primary>network</primary><secondary>roaming configuration</secondary>
zh-CN: <primary>网络</primary><secondary>漫游配置</secondary>

en: Many Falcot engineers have a laptop computer that, for professional purposes, they also use at home. The network configuration to use differs according to location. At home, it may be a wifi network (protected by a WPA key), while the workplace uses a wired network for greater security and more bandwidth.
zh-CN: Falcot 公司的工程师拥有专业用的笔记本电脑，同时也在家里使用它。根据使用场所的不同，网络有不同的配置方式。在家里，可能使用 WiFi 网络 (以 WPA 密钥保护)，在工作场合则使用较安全与带宽更充足的固接网络。

en: To avoid having to manually connect or disconnect the corresponding network interfaces, administrators installed the <emphasis role="pkg">network-manager</emphasis> package on these roaming machines. This software enables a user to easily switch from one network to another using a small icon displayed in the notification area of their graphical desktop. Clicking on this icon displays a list of available networks (both wired and wireless), so they can simply choose the network they wish to use. The program saves the configuration for the networks to which the user has already connected, and automatically switches to the best available network when the current connection drops.
zh-CN: 为了避免人工链接与断线对应的网络接口，管理员在漫游机器安装 <emphasis role="pkg">network-manager</emphasis> 软件包。此软件可以让用户从图形桌面的小图标在多个网络间切换。按下此图标即显示可用的网络（有线与无线连接），以选择其中之一。此程序保存曾连接网络的配置，断线时自动选择最佳的网络。

en: In order to do this, the program is structured in two parts: a daemon running as root handles activation and configuration of network interfaces and a user interface controls this daemon. PolicyKit handles the required authorizations to control this program and Debian configured PolicyKit in such a way so that members of the netdev group can add or change Network Manager connections.
zh-CN: 为了达到这个目的，程序分为两个部份：后台守护进程配置网络接口，用户接口控制该后台进程。PolicyKit 处理必要的权限以控制此程序，然后由 Debian 配置 PolicyKit 让 netdev 群组成员可以添加或修改 Network Manager 的链接。

en: Network Manager knows how to handle various types of connections (DHCP, manual configuration, local network), but only if the configuration is set with the program itself. This is why it will systematically ignore all network interfaces in <filename>/etc/network/interfaces</filename> and <filename>/etc/network/interfaces.d/</filename> for which it is not suited. Since Network Manager doesn't give details when no network connections are shown, the easy way is to delete from <filename>/etc/network/interfaces</filename> any configuration for all interfaces that must be managed by Network Manager.
zh-CN: 网络管理器知道如何处理各种类型的连接（DHCP、手动配置、本地网络），但只能处理程序本身的配置。这是会系统地忽略 <filename>/etc/network/interfaces</filename> 和 <filename>/etc/network/interfaces.d/</filename> 中的所有网络接口的原因。由于网络管理器在未显示网络连接时不提供详细信息，因此简单方法是从 <filename>/etc/network/interfaces</filename> 和其他配置中删除必须由网络管理器管理的网络接口的配置。

en: Note that this program is installed by default when the “Desktop Environment” task is chosen during initial installation.
zh-CN: 注意，在初始安装阶段选择 “桌面环境”的工作，就能够缺省安装此程序。

en: Setting the Hostname and Configuring the Name Service
zh-CN: 设置主机名称与配置名称服务

en: <primary>name</primary><secondary>attribution and resolution</secondary>
zh-CN: <primary>名称</primary><secondary>属性与解析</secondary>

en: <primary>assignment of names</primary>
zh-CN: <primary>指定名称</primary>

en: The purpose of assigning names to IP numbers is to make them easier for people to remember. In reality, an IP address identifies a network interface associated with a device such as a network card. Since each machine can have several network cards, and several interfaces on each card, one single computer can have several names in the domain name system.
zh-CN: 将 IP 数字转换为名称系方便记忆。实务上，IP 地址系用于辨识网络卡之类的网络接口设备。机器可能有多个网络卡，每个网络卡可能有多个接口，所以在网域名称系统里，一部电脑就可能有多个名称。

en: Each machine is, however, identified by a main (or “canonical”) name, stored in the <filename>/etc/hostname</filename> file and communicated to the Linux kernel by initialization scripts through the <command>hostname</command> command. The current value is available in a virtual filesystem, and you can get it with the <command>cat /proc/sys/kernel/hostname</command> command.
zh-CN: 然而，每部机器都有辨识用的主要 (或 “规范”) 名称，保存在 <filename>/etc/hostname</filename> 文件内并以初始脚本经由 <command>hostname</command> 命令与 Linux 核心沟通。当前值保存在虚拟文件系统，可经由 <command>cat /proc/sys/kernel/hostname</command> 命令取得。

en: <emphasis>BACK TO BASICS</emphasis> <filename>/proc/</filename> and <filename>/sys/</filename>, virtual filesystems
zh-CN: <emphasis>基础知识</emphasis> <filename>/proc/</filename> 与 <filename>/sys/</filename>，虚拟文件系统

en: The <filename>/proc/</filename> and <filename>/sys/</filename> file trees are generated by “virtual” filesystems. This is a practical means of recovering information from the kernel (by listing virtual files) and communicating them to it (by writing to virtual files).
zh-CN: <filename>/proc/</filename> 与 <filename>/sys/</filename> 文件树系由 “虚拟” 文件系统产生。从核心 (以列出虚拟文件方式) 取得信息并与其沟通 (写入虚拟文件) 。

en: <filename>/sys/</filename> in particular is designed to provide access to internal kernel objects, especially those representing the various devices in the system. The kernel can, thus, share various pieces of information: the status of each device (for example, if it is in energy saving mode), whether it is a removable device, etc. Note that <filename>/sys/</filename> has only existed since kernel version 2.6. <filename>/proc/</filename> describes the current state of the kernel: the files in this directory contain information about the processes running on the system and its hardware.
zh-CN: <filename>/sys/</filename> 是特别设计提供对内核对象的访问，特别是那些表示系统设备的对象。因此，内核可以共享各种信息：每个设备的状态（如是否处于节能模式）、是否可移动设备等。注意，<filename>/sys/</filename>在内核版本 v2.6 之后才存在。<filename>/proc/</filename> 描述内核的当前状态：此目录中的文件包含有关系统上运行的进程及硬件的信息。

en: Surprisingly, the domain name is not managed in the same way, but comes from the complete name of the machine, acquired through name resolution. You can change it in the <filename>/etc/hosts</filename> file; simply write a complete name for the machine there at the beginning of the list of names associated with the address of the machine, as in the following example:
zh-CN: 意外的是，网域名称的管理方式不同，来自机器的完整名称，经由名称解析取得。可以在 <filename>/etc/hosts</filename> 文件内更改它；在名称清单前写入完整的名称，如下例：

en: <primary><filename>hosts</filename></primary>
zh-CN: <primary><filename>主机</filename></primary>

en: <primary>domain</primary><secondary>name</secondary>
zh-CN: <primary>网域</primary><secondary>名称</secondary>

en: <primary>name</primary><secondary>domain</secondary>
zh-CN: <primary>名称</primary><secondary>网域</secondary>

en: Name Resolution
zh-CN: 名称解析

en: <primary>resolution</primary><secondary>name</secondary>
zh-CN: <primary>解析</primary><secondary>名称</secondary>

en: <primary>name</primary><secondary>resolution</secondary>
zh-CN: <primary>名称</primary><secondary>解析</secondary>

en: The mechanism for name resolution in Linux is modular and can use various sources of information declared in the <filename>/etc/nsswitch.conf</filename> file. The entry that involves host name resolution is <literal>hosts</literal>. By default, it contains <literal>files dns</literal>, which means that the system consults the <filename>/etc/hosts</filename> file first, then DNS servers. NIS/NIS+ or LDAP servers are other possible sources.
zh-CN: Linux 的名称解析机制是模块化的且可使用 <filename>/etc/nsswitch.conf</filename> 宣称的数据源。涉及主机名称解析的条目是 <literal>hosts</literal>。默认情况下，它包括 <literal>files dns</literal>，表示系统先参照 <filename>/etc/hosts</filename> 文件，再参照 DNS 服务器。NIS/NIS+ 或 LDAP 服务器是另一个来源选择。

en: <emphasis>NOTE</emphasis> NSS and DNS
zh-CN: <emphasis>说明</emphasis> NSS 与 DNS

en: Be aware that the commands specifically intended to query DNS (especially <command>host</command>) do not use the standard name resolution mechanism (NSS). As a consequence, they do not take into consideration <filename>/etc/nsswitch.conf</filename>, and thus, not <filename>/etc/hosts</filename> either.
zh-CN: 专门用于查找 DNS 的命令(特别是 <command>host</command>)，未使用标准的名称解析机制 (NSS)。也就是说，完全未考虑 <filename>/etc/nsswitch.conf</filename>，也不使用 <filename>/etc/hosts</filename>。

en: Configuring DNS Servers
zh-CN: 配置 DNS 服务器

en: <primary>Domain Name Service</primary>
zh-CN: <primary>网域名称服务</primary>

en: DNS (Domain Name Service) is a distributed and hierarchical service mapping names to IP addresses, and vice-versa. Specifically, it can turn a human-friendly name such as <literal>www.eyrolles.com</literal> into the actual IP address, <literal>213.244.11.247</literal>.
zh-CN: DNS (网域名称服务) 是映射名称至 IP 地址的分布式分级服务，同时也反向映射。尤其是，把可阅读的名称，如 <literal>www.eyrolles.com</literal> 映射至实际的 IP 地址 <literal>213.244.11.247</literal>。

en: To access DNS information, a DNS server must be available to relay requests. Falcot Corp has its own, but an individual user is more likely to use the DNS servers provided by their ISP.
zh-CN: 必须先设置 DNS 服务器，才能用到 DNS 信息。Falcot 公司自设该服务器，但个人用户可能使用 ISP 提供的 DNS 服务器。

en: The <filename>/etc/hosts</filename> file
zh-CN: <filename>/etc/hosts</filename> 文件

en: If there is no name server on the local network, it is still possible to establish a small table mapping IP addresses and machine hostnames in the <filename>/etc/hosts</filename> file, usually reserved for local network stations. The syntax of this file as described in <citerefentry><refentrytitle>hosts</refentrytitle> <manvolnum>5</manvolnum></citerefentry> is very simple: each line indicates a specific IP address followed by the list of any associated names (the first being “completely qualified”, meaning it includes the domain name).
zh-CN: 在本地网络没有名称服务器时，仍可以在保留给本地网络的 <filename>/etc/hosts</filename> 文件内，创建 IP 地址与主机名称的小型对照表。此文件的语法在 <citerefentry><refentrytitle>hosts</refentrytitle> <manvolnum>5</manvolnum></citerefentry> 中说明，极简单：每列一个固定 IP 地址，然后是相关的名称 (第一个是 “完全合格”，表示包括网域名称)。

en: This file is available even during network outages or when DNS servers are unreachable, but will only really be useful when duplicated on all the machines on the network. The slightest alteration in correspondence will require the file to be updated everywhere. This is why <filename>/etc/hosts</filename> generally only contains the most important entries.
zh-CN: 即使网络停摆或 DNS 服务器不通仍可使用此文件，但只适用于本地网络所有机器都复制的内容。即使是极微小的变动，都需要更新各地所有的文件。所以， <filename>/etc/hosts</filename> 通常只包括最重要的条目。

en: This file will be sufficient for a small network not connected to the Internet, but with 5 machines or more, it is recommended to install a proper DNS server.
zh-CN: 这个文件对未连上互联网的小型网络是够用的，但对于5 部以及以上的机器，推荐安装一个 DNS 服务器。

en: <emphasis>TIP</emphasis> Bypassing DNS
zh-CN: <emphasis>秘诀</emphasis> 绕过 DNS

en: Since applications check the <filename>/etc/hosts</filename> file before querying DNS, it is possible to include information in there that is different from what the DNS would return, and therefore to bypass normal DNS-based name resolution.
zh-CN: 某些应用程序先检查 <filename>/etc/hosts</filename> 文件才查找 DNS，与 DNS 送回数据不同的部分，可以先保存在这里，并略过 DNS 的名称解析。

en: This allows, in the event of DNS changes not yet propagated, to test access to a website with the intended name even if this name is not properly mapped to the correct IP address yet.
zh-CN: 修改 DNS 但尚未部署前，这种做法可以测试网站名称与 IP 地址的对应性。

en: Another possible use is to redirect traffic intended for a specific host to the localhost, thus preventing any communication with the given host. For example, hostnames of servers dedicated to serving ads could be diverted which would bypass these ads resulting in more fluid, less distracting, navigation.
zh-CN: 另一个可能用法是把流量转移至指定的区域主机，避免大流量进入指定的主机。例如，可以绕过专供广告使用的服务器主机名称，让结果更顺畅、少些干扰。

en: User and Group Databases
zh-CN: 用户与群组数据库

en: <primary>database</primary><secondary>of users</secondary>
zh-CN: <primary>数据库</primary><secondary>用户</secondary>

en: <primary>database</primary><secondary>of groups</secondary>
zh-CN: <primary>数据库</primary><secondary>群组</secondary>

en: The list of users is usually stored in the <filename>/etc/passwd</filename> file, while the <filename>/etc/shadow</filename> file stores hashed passwords. Both are text files, in a relatively simple format, which can be read and modified with a text editor. Each user is listed there on a line with several fields separated with a colon (“<literal>:</literal>”).
zh-CN: 用户清单通常保存在 <filename>/etc/passwd</filename> 文件内，把哈希编码后的密码保存在 <filename>/etc/shadow</filename> 文件内。这两个文件都是纯文本档，以简单的格式保存，可以用文本编辑器读取与修改。每个用户占一行，其字段以冒号分隔 (“<literal>:</literal>”)。

en: <emphasis>NOTE</emphasis> Editing system files
zh-CN: <emphasis>说明</emphasis> 编辑系统文件

en: The system files mentioned in this chapter are all plain text files, and can be edited with a text editor. Considering their importance to core system functionality, it is always a good idea to take extra precautions when editing system files. First, always make a copy or backup of a system file before opening or altering it. Second, on servers or machines where more than one person could potentially access the same file at the same time, take extra steps to guard against file corruption.
zh-CN: 本章讨论的系统文件都是纯文本档，可以用文本编辑器处理。这些文件对内核系统的运作极为重要，编辑该等文件时多加慎重不会错的。首先，先复制或备份原文件。第二，在服务器或多人可同时使用该等文件的机器上，多费心以防止文件损坏。

en: For this purpose, it is enough to use the <command>vipw</command> command to edit the <filename>/etc/passwd</filename> file, or <command>vigr</command> to edit <filename>/etc/group</filename>. These commands lock the file in question prior to running the text editor, (<command>vi</command> by default, unless the <varname>EDITOR</varname> environment variable has been altered). The <literal>-s</literal> option in these commands allows editing the corresponding <foreignphrase>shadow</foreignphrase> file.
zh-CN: 为了达成此目标，最好使用 <command>vipw</command> 命令编辑 <filename>/etc/passwd</filename> 文件，或使用 <command>vigr</command> 命令编辑 <filename>/etc/group</filename> 文件。这些命令会先锁住该文件再运行文本编辑器， (缺省使用 <command>vi</command> 命令，除非 <varname>EDITOR</varname> 环境变量有其他的设置)。加上 <literal>-s</literal> 选项可同时编辑对应的 <foreignphrase>shadow</foreignphrase> 文件。

en: <emphasis>BACK TO BASICS</emphasis> Crypt, a one-way function
zh-CN: <emphasis>基础知识</emphasis> Crypt，单向的函数

en: <command>crypt</command> is a one-way function that transforms a string (<varname>A</varname>) into another string (<varname>B</varname>) in a way that <varname>A</varname> cannot be derived from <varname>B</varname>. The only way to identify <varname>A</varname> is to test all possible values, checking each one to determine if transformation by the function will produce <varname>B</varname> or not. It uses up to 8 characters as input (string <varname>A</varname>) and generates a string of 13, printable, ASCII characters (string <varname>B</varname>).
zh-CN: <command>crypt</command> 是单向函数以特别的方法把字符串 (<varname>A</varname>) 转换成另个字符串 (<varname>B</varname>)，转换后无法经由 <varname>B</varname> 恢复成 <varname>A</varname> 。辨识 <varname>A</varname> 的唯一方法是逐一测试所有可能的值，查验等同于 <varname>B</varname> 的结果。最多可输入 8 个字符 (字符串 <varname>A</varname>) 然后产生 13 个字符的可打印 ASCII 字符 (字符串 <varname>B</varname>)。

en: User List: <filename>/etc/passwd</filename>
zh-CN: 用户清单：<filename>/etc/passwd</filename>

en: <primary>password</primary>
zh-CN: <primary>密码</primary>

en: Here is the list of fields in the <filename>/etc/passwd</filename> file:
zh-CN: 在 <filename>/etc/passwd</filename> 文件内的字段清单：

en: login, for example <literal>rhertzog</literal>;
zh-CN: 登录，例如 <literal>rhertzog</literal>;

en: <literal>uid</literal>: unique number identifying each user;
zh-CN: <literal>uid</literal>：用于辨识用户的不重复数字;

en: <literal>gid</literal>: unique number for the user's main group (Debian creates a specific group for each user by default);
zh-CN: <literal>gid</literal>：用户主要群组 (Debian 的默认值系为每个用户创建一个群组) 的不重复号码;

en: <literal>GECOS</literal>: data field usually containing the user's full name;
zh-CN: <literal>GECOS</literal>：通常保存用户全名的数据栏;

en: login directory, assigned to the user for storage of their personal files (the environment variable <varname>$HOME</varname> generally points here);
zh-CN: 登入目录，用于保存用户的个人文件 (环境变量 <varname>$HOME</varname> 通常指向此处);

en: program to execute upon login. This is usually a command interpreter (shell), giving the user free rein. If you specify <command>/bin/false</command> (which does nothing and returns control immediately), the user cannot login.
zh-CN: 登录时运行的程序。通常是命令解译器 (shell)，若指定为 <command>/bin/false</command> (不做任何事并立即回到控制)，则用户无法登录。

en: <emphasis>BACK TO BASICS</emphasis> Unix group
zh-CN: <emphasis>基础知识</emphasis> Unix 群组

en: <primary>group</primary>
zh-CN: <primary>群组</primary>

en: A Unix group is an entity including several users so that they can easily share files using the integrated permission system (by benefiting from the same rights). You can also restrict use of certain programs to a specific group.
zh-CN: Unix 群组是包括多个用户的实体，以集成授权系统可以共享文件 (具有同样的权限)。可以限定程序供指定的群组使用。

en: The Hidden and Encrypted Password File: <filename>/etc/shadow</filename>
zh-CN: 隐藏与加密的密码档：<filename>/etc/shadow</filename>

en: The <filename>/etc/shadow</filename> file contains the following fields:
zh-CN: <filename>/etc/shadow</filename> 文件含以下的字段：

en: login;
zh-CN: 登录;

en: encrypted password;
zh-CN: 加密的密码;

en: several fields managing password expiration.
zh-CN: 管理密码期限的字段。

en: <emphasis>SECURITY</emphasis> <filename>/etc/shadow</filename> file security
zh-CN: <emphasis>安全</emphasis> <filename>/etc/shadow</filename> 文件的安全

en: <filename>/etc/shadow</filename>, unlike its alter-ego, <filename>/etc/passwd</filename>, cannot be read by regular users. Any hashed password stored in <filename>/etc/passwd</filename> is readable by anybody; a cracker could try to “break” (or reveal) a password by one of several “brute force” methods which, simply put, guess at commonly used combinations of characters. This attack — called a "dictionary attack" — is no longer possible on systems using <filename>/etc/shadow</filename>.
zh-CN: <filename>/etc/shadow</filename>，不同于它的分身，<filename>/etc/passwd</filename>，不能被一般用户读取。保存在 <filename>/etc/passwd</filename> 内的哈希编码后的密码可被任何人读取；破坏者可以用 “暴力” 法破坏它们，以常见的编码字符破解。这种攻击方式 — 称为 "字典攻击" — 对于使用 <filename>/etc/shadow</filename> 的系统是无效的。

en: <emphasis>DOCUMENTATION</emphasis> <filename>/etc/passwd</filename>, <filename>/etc/shadow</filename> and <filename>/etc/group</filename> file formats
zh-CN: <emphasis>文档</emphasis> <filename>/etc/passwd</filename>、<filename>/etc/shadow</filename> 与 <filename>/etc/group</filename> 文件格式

en: Modifying an Existing Account or Password
zh-CN: 修改既有的帐号或密码

en: Finally, the <command>chage</command> (CHange AGE) command allows the administrator to change the password expiration settings (the <literal>-l <replaceable>user</replaceable></literal> option will list the current settings). You can also force the expiration of a password using the <command>passwd -e <replaceable>user</replaceable></command> command, which will require the user to change their password the next time they log in.
zh-CN: 最后，<command>chage</command> (CHange AGE) 命令允许管理者变更密码的有效期 (<literal>-l <replaceable>用户</replaceable></literal> 选项列出现在的设置)。用 <command>passwd -e <replaceable>用户</replaceable></command> 命令强迫密码失效，要求用户登录时变更密码才能继续使用。

en: Disabling an Account
zh-CN: 帐号禁用

en: <primary>account</primary><secondary>disable</secondary>
zh-CN: <primary>帐号</primary><secondary>禁用</secondary>

en: <emphasis>GOING FURTHER</emphasis> NSS and system databases
zh-CN: <emphasis>进一步</emphasis> NSS 与系统数据库

en: Instead of using the usual files to manage lists of users and groups, you could use other types of databases, such as LDAP or <command>db</command>, by using an appropriate NSS (Name Service Switch) module. The modules used are listed in the <filename>/etc/nsswitch.conf</filename> file, under the <literal>passwd</literal>, <literal>shadow</literal> and <literal>group</literal> entries. See <xref linkend="sect.config-nss" /> for a specific example of the use of an NSS module by LDAP.
zh-CN: 除了使用文件管理用户与群组清单，还可以通过适当的 NSS (Name Service Switch 切换i昵称服务) 模块使用其他数据库类型，诸如 LDAP 或 <command>db</command>。可用的模块列在 <filename>/etc/nsswitch.conf</filename> 文件内，在 <literal>passwd</literal>、<literal>shadow</literal> 与 <literal>group</literal> 条目下。LDAP 下的 NSS 模块使用法，见 <xref linkend="sect.config-nss" />。

en: Group List: <filename>/etc/group</filename>
zh-CN: 群组清单：<filename>/etc/group</filename>

en: Groups are listed in the <filename>/etc/group</filename> file, a simple textual database in a format similar to that of the <filename>/etc/passwd</filename> file, with the following fields:
zh-CN: 群组列在 <filename>/etc/group</filename> 文件内，类似 <filename>/etc/passwd</filename> 文件的纯文本数据库，包括以下的字段：

en: group name;
zh-CN: 群组名称;

en: password (optional): This is only used to join a group when one is not a usual member (with the <command>newgrp</command> or <command>sg</command> commands, see sidebar <xref linkend="sidebar.working-with-several-groups" />);
zh-CN: 密码 (可选)：只在加入群组时会用到 (使用 <command>newgrp</command> 或 <command>sg</command> 命令，见专栏 <xref linkend="sidebar.working-with-several-groups" />);

en: <literal>gid</literal>: unique group identification number;
zh-CN: <literal>gid</literal>：不重复的群组识别码;

en: list of members: list of names of users who are members of the group, separated by commas.
zh-CN: 成员清单：属于此群组的用户名清单，以逗号分隔。

en: <emphasis>BACK TO BASICS</emphasis> Working with several groups
zh-CN: <emphasis>基本知识</emphasis> 在多个群组工作

en: <primary>group</primary><secondary>change</secondary>
zh-CN: <primary>群组</primary><secondary>改变</secondary>

en: Each user may be a member of many groups; one of them is their “main group”. A user's main group is, by default, created during initial user configuration. By default, each file that a user creates belongs to them, as well as to their main group. This is not always desirable; for example, when the user needs to work in a directory shared by a group other than their main group. In this case, the user needs to change their main group using one of the following commands: <command>newgrp</command>, which starts a new shell, or <command>sg</command>, which simply executes a command using the supplied alternate group. These commands also allow the user to join a group to which they do not belong. If the group is password protected, they will need to supply the appropriate password before the command is executed.
zh-CN: 用户可能加入多个群组；其中一个是 “主群组”。用户自己的主群组默认是初始化用户配置时自动产生的。默认情况下，用户添加的文件自动属于该用户，以及其主群组。这种方式并不重视可取的；例如，用户需要在自己主群组文件夹之外工作，与其他群组共享其文件。在这种情况下，用户需以命令：<command>newgrp</command> 变更其主要群组，启动新的 shell，或以 <command>sg</command> 命令，使用其他群组执行一个命令。这些命令也允许用户加入其他群组。若该群组受密码保护，则需先取得密码才能运行该等命令。

en: Alternatively, the user can set the <literal>setgid</literal> bit on the directory, which causes files created in that directory to automatically belong to the correct group. For more details, see sidebar <xref linkend="sidebar.setgid-dir" />.
zh-CN: 用户还可以设置文件夹的 <literal>setgid</literal> 位，让该文件夹内的文件自动属于特定群组。详情见专栏 <xref linkend="sidebar.setgid-dir" />。

en: The <command>id</command> command displays the current state of a user, with their personal identifier (<varname>uid</varname> variable), current main group (<varname>gid</varname> variable), and the list of groups to which they belong (<varname>groups</varname> variable).
zh-CN: <command>id</command> 命令显示用户的当前状态，包括个人辨识码 (<varname>uid</varname> 变量)、当前的主群组 (<varname>gid</varname> 变量)、以及其所属群组的清单 (<varname>groups</varname> 变量)。

en: The <command>addgroup</command> and <command>delgroup</command> commands add or delete a group, respectively. The <command>groupmod</command> command modifies a group's information (its <literal>gid</literal> or identifier). The command <command>gpasswd <replaceable>group</replaceable></command> changes the password for the group, while the <command>gpasswd -r <replaceable>group</replaceable></command> command deletes it.
zh-CN: <command>addgroup</command> 与 <command>delgroup</command> 命令可以添加或删除群组。<command>groupmod</command> 命令修改群组的信息 (其 <literal>gid</literal> 或辨识码)。命令 <command>gpasswd <replaceable>group</replaceable></command> 可变更群组的密码，<command>gpasswd -r <replaceable>group</replaceable></command> 命令可删除群组的密码。

en: <primary>group</primary><secondary>creation</secondary>
zh-CN: <primary>群组</primary><secondary>添加</secondary>

en: <primary>group</primary><secondary>deletion</secondary>
zh-CN: <primary>群组</primary><secondary>删除</secondary>

en: <primary>creation</primary><secondary>of groups</secondary>
zh-CN: <primary>添加</primary><secondary>群组</secondary>

en: <emphasis>TIP</emphasis> <command>getent</command>
zh-CN: <emphasis>秘诀</emphasis> <command>getent</command>

en: The <command>getent</command> (get entries) command checks the system databases the standard way, using the appropriate library functions, which in turn call the NSS modules configured in the <filename>/etc/nsswitch.conf</filename> file. The command takes one or two arguments: the name of the database to check, and a possible search key. Thus, the command <command>getent passwd rhertzog</command> will give the information from the user database regarding the user <literal>rhertzog</literal>.
zh-CN: <command>getent</command> (get entries) 命令使用适当的程序库函数，调用配置于 <filename>/etc/nsswitch.conf</filename> 文件的 NSS 模块，以标准方式检查系统数据库。此命令需要一个或两个参数：被检查的数据库名称、以及可能的搜索键词。因此，<command>getent passwd rhertzog</command> 命令将从用户 <literal>rhertzog</literal> 中给予用户数据库。

en: Creating Accounts
zh-CN: 添加帐号

en: <primary>account</primary><secondary>creation</secondary>
zh-CN: <primary>帐号</primary><secondary>添加</secondary>

en: <primary>creation</primary><secondary>of user accounts</secondary>
zh-CN: <primary>添加</primary><secondary>用户帐号</secondary>

en: One of the first actions an administrator needs to do when setting up a new machine is to create user accounts. This is typically done using the <command>adduser</command> command which takes a user-name for the new user to be created, as an argument.
zh-CN: 设置新机器后管理者需做的第一件事就是添加用户帐号。以 <command>adduser</command> 命令添加用户的名称，作为其参数。

en: The <command>adduser</command> command asks a few questions before creating the account, but its usage is fairly straightforward. Its configuration file, <filename>/etc/adduser.conf</filename>, includes all the interesting settings: it can be used to automatically set a quota for each new user by creating a user template, or to change the location of user accounts; the latter is rarely useful, but it comes in handy when you have a large number of users and want to divide their accounts over several disks, for instance. You can also choose a different default shell.
zh-CN: <command>adduser</command> 命令在添加帐号前先询问若干问题，但其使用方式相当直观。 <filename>/etc/adduser.conf</filename> 是它的配置档，包括有趣的设置：可用于自动设置用户的配额、或改变用户帐号的位置；后者较少使用，但有多个用户且需分隔帐号于若干硬盘时，就是很好用的工具。也可选择不同的 shell 为默认值。

en: <emphasis>BACK TO BASICS</emphasis> Quota
zh-CN: <emphasis>基本知识</emphasis> 额度

en: <primary>quota</primary>
zh-CN: <primary>额度</primary>

en: The term “quota” refers to a limit on machine resources that a user is allowed to use. This frequently refers to disk space.
zh-CN: “额度” 指的是用户在此机器可使用的资源上限。通常指的是磁盘空间。

en: The creation of an account populates the user's home directory with the contents of the <filename>/etc/skel/</filename> template. This provides the user with a set of standard directories and configuration files.
zh-CN: 添加帐号时，把用户的家目录设置为与 <filename>/etc/skel/</filename> 模板目录相同。这样可以提供给用户一组标准的文件夹与配置文件。

en: <primary>group</primary><secondary>add a user</secondary>
zh-CN: <primary>群组</primary><secondary>添加用户</secondary>

en: <primary>add a user to a group</primary>
zh-CN: <primary>添加群组的用户</primary>

en: In some cases, it will be useful to add a user to a group (other than their default “main” group) in order to grant them additional permissions. For example, a user who is included in the <emphasis>audio</emphasis> group can access audio devices (see sidebar <xref linkend="sidebar.special-files" />). This can be achieved with a command such as <command>adduser <replaceable>user</replaceable> <replaceable>group</replaceable></command>.
zh-CN: 有的时候，把用户加入群组 (除了缺省的 “主要” 群组) 以取得额外的权限。例如，在 <emphasis>audio</emphasis> 群组内的用户可以使用该群组内的音效设备 (见专栏 <xref linkend="sidebar.special-files" />)。以 <command>adduser <replaceable>user</replaceable> <replaceable>group</replaceable></command> 命令就能把用户加入该群组。

en: <emphasis>BACK TO BASICS</emphasis> Device access permissions
zh-CN: <emphasis>基本知识</emphasis> 设备访问权限

en: <primary>device</primary><secondary>access permissions</secondary>
zh-CN: <primary>设备</primary><secondary>访问权限</secondary>

en: <primary>mode</primary><secondary>character</secondary>
zh-CN: <primary>模式</primary><secondary>字符</secondary>

en: <primary>mode</primary><secondary>block</secondary>
zh-CN: <primary>模式</primary><secondary>区块</secondary>

en: <primary>block, mode</primary>
zh-CN: <primary>区块，模块</primary>

en: <primary>character, mode</primary>
zh-CN: <primary>字符，模式</primary>

en: <primary>special, file</primary>
zh-CN: <primary>特别，文件</primary>

en: Each hardware peripheral device is represented under Unix with a special file, usually stored in the file tree under <filename>/dev/</filename> (DEVices). Two types of special files exist according to the nature of the device: “character mode” and “block mode” files, each mode allowing for only a limited number of operations. While character mode limits interaction with read/write operations, block mode also allows seeking within the available data. Finally, each special file is associated with two numbers (“major” and “minor”) that identify the device to the kernel in a unique manner. Such a file, created by the <command>mknod</command> command, simply contains a symbolic (and more human-friendly) name.
zh-CN: 在 Unix 之下，每个周边硬件设备都是一个保存在 <filename>/dev/</filename> (DEVices) 的特别文件。根据设备的特性有两种特别文件：“字符模式” 与 “区块模式” 文件，每个模式都只有固定数量的操作。字符模式限制读/写操作，区块模式还允许搜索可得的数据。最后，每个特别文件有两个数字 (“主要” 与 “次要”) 供内核辨识该设备。这种文件以 <command>mknod</command> 命令添加，包括符号名称 (人类可以理解的符号)。

en: The permissions of a special file map to the permissions necessary to access the device itself. Thus, a file such as <filename>/dev/mixer</filename>, representing the audio mixer, only has read/write permissions for the root user and members of the <literal>audio</literal> group. Only these users can operate the audio mixer.
zh-CN: 特别文件的权限映射至设备本身的访问权限。因此，<filename>/dev/mixer</filename> 这个文件代表混音器，只有root用户与 <literal>audio</literal> 群组的用户拥有读/取权限。且只有该用户才能操作混音器。

en: It should be noted that the combination of <emphasis role="pkg">udev</emphasis> and <emphasis role="pkg">policykit</emphasis> can add additional permissions to allow users physically connected to the console (and not through the network) to access to certain devices.
zh-CN: 使用 <emphasis role="pkg">udev</emphasis> 与 <emphasis role="pkg">policykit</emphasis> 指令，用户就可以直接操作 (不经由网络) 这些设备。

en: Shell Environment
zh-CN: Shell 环境

en: Command interpreters (or shells) can be a user's first point of contact with the computer, and they must therefore be rather friendly. Most of them use initialization scripts that allow configuration of their behavior (automatic completion, prompt text, etc.).
zh-CN: 命令解译器 (或 shells) 是用户接触电脑的第一个点，必须足够友善。大部分的人使用初始设置的脚本配置其行为 (自动完成、提示字符等)。

en: <primary>command line interface</primary>
zh-CN: <primary>命令行接口</primary>

en: <primary>command interpreter</primary>
zh-CN: <primary>命令解译器</primary>

en: <command>bash</command>, the standard shell, uses the <filename>/etc/bash.bashrc</filename> initialization script for “interactive” shells, and <filename>/etc/profile</filename> for “login” shells.
zh-CN: <command>bash</command> 是标准的 shell，使用 <filename>/etc/bash.bashrc</filename> 初始脚本为 “交互” shell 初始化，并以 <filename>/etc/profile</filename> 作为 “登录” shell。

en: In simple terms, a login shell is invoked when you login to the console either locally or remotely via <command>ssh</command>, or when you run an explicit <command>bash --login</command> command. Regardless of whether it is a login shell or not, a shell can be interactive (in an <command>xterm</command>-type terminal for instance); or non-interactive (when executing a script).
zh-CN: 简单地说，不论本地登录或使用 <command>ssh</command> 远程登录，或以 <command>bash --login</command> 命令登录，都启用登录 shell。在 登录或非登录 shell 里，该 shell 必须是交互的 (例如在 <command>xterm</command>-type 终端机内)；或非交互式 (执行脚本时)。

en: <emphasis>DISCOVERY</emphasis> Other shells, other scripts
zh-CN: <emphasis>发现</emphasis> 其他 shells、其他脚本

en: <emphasis>BACK TO BASICS</emphasis> Automatic completion
zh-CN: <emphasis>基础知识</emphasis> 自动补完

en: <primary>automatic completion</primary>
zh-CN: <primary>自动补完</primary>

en: Many command interpreters provide a completion feature, which allows the shell to automatically complete a partially typed command name or argument when the user hits the <keycap>Tab</keycap> key. This lets users work more efficiently and be less error-prone.
zh-CN: 若干命令解译器提供补完功能，即键入命令前几个字后，用户按 <keycap>Tab</keycap> ，shell 自动补完命令名称或参数。用户的工作更有效率且更少错误。

en: This function is very powerful and flexible. It is possible to configure its behavior according to each command. Thus, the first argument following <command>apt</command> will be proposed according to the syntax of this command, even if it does not match any file (in this case, the possible choices are <literal>install</literal>, <literal>remove</literal>, <literal>upgrade</literal>, etc.).
zh-CN: 此函数极有用并富弹性。可根据每个命令分别配置。因此，<command>apt</command> 之后的第一个参数，即使未映射任何文件 (在本例中，可能的选择为 <literal>install</literal>、<literal>remove</literal>、<literal>upgrade</literal>等)，也可根据此命令的语法构建。

en: <emphasis>BACK TO BASICS</emphasis> The tilde, a shortcut to HOME
zh-CN: <emphasis>基础知识</emphasis> 波浪号（“~”），回到home文件夹的捷径

en: The tilde is often used to indicate the directory to which the environment variable, <varname>HOME</varname>, points (being the user's home directory, such as <filename>/home/rhertzog/</filename>). Command interpreters automatically make the substitution: <filename>~/hello.txt</filename> becomes <filename>/home/rhertzog/hello.txt</filename>.
zh-CN: 波浪号（“~”）通常用于表示环境变量 <varname>HOME</varname> ，指向 (就是用户的home文件夹，如 <filename>/home/rhertzog/</filename>) 的文件夹。命令解译器自动取代：<filename>~/hello.txt</filename> 就是 <filename>/home/rhertzog/hello.txt</filename>。

en: The tilde also allows access to another user's home directory. Thus, <filename>~rmas/bonjour.txt</filename> is synonymous with <filename>/home/rmas/bonjour.txt</filename>.
zh-CN: 波浪号也可使用至另一个用户的home文件夹。因此，<filename>~rmas/bonjour.txt</filename> 等于 <filename>/home/rmas/bonjour.txt</filename>。

en: <emphasis>BACK TO BASICS</emphasis> Environment variables
zh-CN: <emphasis>基础知识</emphasis> 环境变量

en: <primary>variable, environment</primary>
zh-CN: <primary>变量，环境</primary>

en: Environment variables allow storage of global settings for the shell or various other programs called. They are contextual (each process has its own set of environment variables) but inheritable. This last characteristic offers the possibility for a login shell to declare variables which will be passed down to all programs it executes.
zh-CN: 环境变量保存供 shell 或其他程序使用的全域设置。它们是与环境相关的 (每个进程都有自己的环境变量) 但可继承的。最后这个特性让登录 shell 时可以声明继承所有程序的变量。

en: <emphasis>TIP</emphasis> All shells configured identically
zh-CN: <emphasis>秘诀</emphasis> 所有的 shell 拥有相同的配置

en: Printer Configuration
zh-CN: 打印机配置

en: <primary>configuration</primary><secondary>printing</secondary>
zh-CN: <primary>配置</primary><secondary>打印</secondary>

en: <primary>printing</primary><secondary>configuration</secondary>
zh-CN: <primary>打印</primary><secondary>配置</secondary>

en: <emphasis>COMMUNITY</emphasis> CUPS
zh-CN: <emphasis>社区</emphasis> CUPS

en: As a package recommended by <emphasis role="pkg">cups-daemon</emphasis>, <emphasis role="pkg">cups-browsed</emphasis> will be on the system and networked print queues, and modern printers can be automatically discovered and set up from their DNS-SD broadcasts (Bonjour). USB printers will have to be set up manually as described in the next paragraph.
zh-CN: 作为 <emphasis role="pkg">cups-daemon</emphasis> 建议的软件包，<emphasis role="pkg">cups-browsed</emphasis> 将在系统和网络上监测打印队列，现代的打印机可以从DNS-SD广播 (Bonjour)自动发现和设置。USB打印机必须用下面说明方式手工设置。

en: Configuring the Bootloader
zh-CN: 配置引导加载器（Bootloader）

en: <primary>loader</primary><secondary>bootloader</secondary>
zh-CN: <primary>加载器</primary><secondary>引导加载器</secondary>

en: <primary>bootloader</primary>
zh-CN: <primary>引导加载器</primary>

en: It is probably already functional, but it is always good to know how to configure and install the bootloader in case it disappears from the Master Boot Record. This can occur after installation of another operating system, such as Windows. The following information can also help you to modify the bootloader configuration if needed.
zh-CN: 或许已经运作了，但最好知道如何配置与安装引导加载器，万一它不在MBR中。安装 Windows 等其他操作系统后，很可能出现这种情况。以下的信息在必要时可协助修改引导加载器的配置。

en: <emphasis>BACK TO BASICS</emphasis> Master boot record
zh-CN: <emphasis>基础知识</emphasis> 主引导记录（MBR）

en: The Master Boot Record (MBR) occupies the first 512 bytes of the first hard disk, and is the first thing loaded by the BIOS to hand over control to a program capable of booting the desired operating system. In general, a bootloader gets installed in the MBR, removing its previous content.
zh-CN: 主引导记录 (Master Boot Record, MBR) 位于第一个磁盘的最前方 512 字节，首先被 BIOS 加载，再启动操作系统。一般来说，安装引导加载器到主引导记录时，会移除之前的内容。

en: Identifying the Disks
zh-CN: 辨识磁盘

en: <emphasis>CULTURE</emphasis> <emphasis>udev</emphasis> and <filename>/dev/</filename>
zh-CN: <emphasis>文化</emphasis> <emphasis>udev</emphasis> 与 <filename>/dev/</filename>

en: The <filename>/dev/</filename> directory traditionally houses so-called “special” files, intended to represent system peripherals (see sidebar <xref linkend="sidebar.special-files" />). Once upon a time, it used to contain all special files that could potentially be used. This approach had a number of drawbacks among which the fact that it restricted the number of devices that one could use (due to the hardcoded list of names), and that it was impossible to know which special files were actually useful.
zh-CN: <filename>/dev/</filename> 文件夹通常保存被称为 “特殊的” 文件，用于代表系统的周边设备 (见专栏 <xref linkend="sidebar.special-files" />)。曾经纳入所有可能用到的特殊文件。这种处理方式有若干缺点，限制设备数量是其中之一，每种设备只能有一个 (因为清单名称被限制)，且不可能知道实际上该用哪个特殊文件。

en: Nowadays, the management of special files is entirely dynamic and matches better the nature of hot-swappable computer devices. The kernel cooperates with <emphasis>udev</emphasis> (<xref linkend="sect.udev" />) to create and delete them as needed when the corresponding devices appear and disappear. For this reason, <filename>/dev/</filename> doesn't need to be persistent and is thus a RAM-based filesystem that starts empty and contains only the relevant entries.
zh-CN: 如今，以动态方式管理特殊文件，并且更适合热切换电脑设备。内核与 <emphasis>udev</emphasis> (<xref linkend="sect.udev" />) 合作在需要的时候添加与删除文件以映射出现或消失的设备。所以，<filename>/dev/</filename> 不需要维持不变，反而采用 RAM 保存的文件系统清除或纳入相关的条目。

en: With dynamically assigned names, you can thus keep the same name for a given device, regardless of the connector used or the connection order, which is especially useful when you use various USB peripherals. The first partition on the first hard drive can then be called <filename>/dev/sda1</filename> for backwards compatibility, or <filename>/dev/root-partition</filename> if you prefer, or even both at the same time since <command>udevd</command> can be configured to automatically create a symbolic link.
zh-CN: 动态给予名称，就能够让相同的名称永远指向特定设备，不必在意链接的设备或顺序，尤其在使用 USB 周边时更为便利。第一个磁盘的第一个分区称为 <filename>/dev/sda1</filename> 可供向后兼容，喜欢的话也可称为 <filename>/dev/root-partition</filename>，或两者共用，因为 <command>udevd</command> 可以配置成自动添加符号链接。

en: <primary>hard drive, names</primary>
zh-CN: <primary>硬盘，名称</primary>

en: <primary>names</primary><secondary>of hard drives</secondary>
zh-CN: <primary>名称</primary><secondary>硬盘</secondary>

en: Configuration of the bootloader must identify the different hard drives and their partitions. Linux uses “block” special files stored in the <filename>/dev/</filename> directory, for this purpose. Since Debian <emphasis role="distribution">Squeeze</emphasis>, the naming scheme for hard drives has been unified by the Linux kernel, and all hard drives (IDE/PATA, SATA, SCSI, USB, IEEE 1394) are now represented by <filename>/dev/sd*</filename>.
zh-CN: 配置引导加载器必须辨认硬盘及其分区。Linux 使用 “block” 特殊文件保存在 <filename>/dev/</filename> 文件夹内。由 Debian <emphasis role="distribution">Squeeze</emphasis> 版本开始使用源自 Linux 内核的硬盘命名架构，所有的硬盘 (IDE/PATA、SATA、SCSI、USB、IEEE 1394) 都以 <filename>/dev/sd*</filename> 表示。

en: Each partition is represented by its number on the disk on which it resides: for instance, <filename>/dev/sda1</filename> is the first partition on the first disk, and <filename>/dev/sdb3</filename> is the third partition on the second disk.
zh-CN: 每个分区由其磁盘代号表示：如，<filename>/dev/sda1</filename> 是第一个磁盘的第一个分区，而 <filename>/dev/sdb3</filename> 是第二个磁盘的第三个分区。

en: <primary>partition</primary><secondary>primary</secondary>
zh-CN: <primary>分区</primary><secondary>主要</secondary>

en: <primary>partition</primary><secondary>extended</secondary>
zh-CN: <primary>分区</primary><secondary>扩展</secondary>

en: <primary>partition</primary><secondary>secondary</secondary>
zh-CN: <primary>分区</primary><secondary>次要</secondary>

en: <primary>partition table</primary><secondary>MS-DOS format</secondary>
zh-CN: <primary>分区表</primary><secondary>MS-DOS 格式</secondary>

en: The PC architecture (or “i386”, including its younger cousin “amd64”) has long been limited to using the “MS-DOS” partition table format, which only allows four “primary” partitions per disk. To go beyond this limitation under this scheme, one of them has to be created as an “extended” partition, and it can then contain additional “secondary” partitions. These secondary partitions are numbered from 5. Thus the first secondary partition could be <filename>/dev/sda5</filename>, followed by <filename>/dev/sda6</filename>, etc.
zh-CN: PC 架构 (或 “i386”，包括新出现的 “amd64”) 不再受限于使用 “MS-DOS” 分区表格式，每个磁盘可以拥有超过 4 个 “主要” 分区。在此架构下要超过此限制，必须添加 “扩展” 分区，然后就能使用添加的 “次要” 分区。这些次要分区由 5 开始编号。所以，第一个磁盘的次要分区可以是 <filename>/dev/sda5</filename>，然后是 <filename>/dev/sda6</filename>，余此类推。

en: Another restriction of the MS-DOS partition table format is that it only allows disks up to 2 TiB in size, which is becoming a real problem with recent disks.
zh-CN: MS-DOS 分区表格式的另一个限制是磁盘的容量不能超过 2 TiB，这成为现代磁盘的真正问题。

en: <primary>GPT</primary><secondary>partition table format</secondary>
zh-CN: <primary>GPT</primary><secondary>分区表格式</secondary>

en: <primary>partition table</primary><secondary>GPT format</secondary>
zh-CN: <primary>分区表</primary><secondary>GPT 格式</secondary>

en: The example configuration files given in the following sections are based on the same setup: a single SATA disk, where the first partition is an old Windows installation and the second contains Debian GNU/Linux.
zh-CN: 下面的配置根据同样的设置而来：一个 SATA 磁盘，第一个区分安装了旧的Windows系统、第二个分区安装了 Debian GNU/Linux。

en: <emphasis>LILO</emphasis> (LInux LOader) is the oldest bootloader — solid but rustic. It writes the physical address of the kernel to boot on the MBR, which is why each update to LILO (or its configuration file) must be followed by the command <command>lilo</command>. Forgetting to do so will render a system unable to boot if the old kernel was removed or replaced as the new one will not be in the same location on the disk.
zh-CN: <emphasis>LILO</emphasis> (Linux 加载器，LInux LOader) 是最旧的引导加载器 — 稳定但粗糙。把启动内核的物理地址写入到MBR中，所以每次更新 LILO (或其配置文件) 都必须再运行命令 <command>lilo</command>。忘记的话，移除或更新内核后，新的内核就不在磁盘的原来位置，以致系统无法启动。

en: LILO's configuration file is <filename>/etc/lilo.conf</filename>; a simple file for standard configuration is illustrated in the example below.
zh-CN: LILO 的配置档是 <filename>/etc/lilo.conf</filename>；一个简单的标准配置文件示例如下。

en: LILO configuration file
zh-CN: LILO 配置文件

en: GRUB 2 Configuration
zh-CN: GRUB 2 配置

en: <emphasis>NOTE</emphasis> Disk names for GRUB
zh-CN: <emphasis>说明</emphasis> GRUB 的磁盘名称

en: Partitions also have a specific name in GRUB. When you use “classical” partitions in MS-DOS format, the first partition on the first disk is labeled, <literal>(hd0,msdos1)</literal>, the second <literal>(hd0,msdos2)</literal>, etc.
zh-CN: 分区表在 GRUB 内也有特定的名称。通常使用 MS-DOS 格式的 “经典” 分区，第一个磁盘的第一个分区标记为 <literal>(hd0,msdos1)</literal>、第二个分区标记为 <literal>(hd0,msdos2)</literal>，余此类推。

en: Other Configurations: Time Synchronization, Logs, Sharing Access…
zh-CN: 其他配置：时间同步、日志记录、共享访问…

en: The many elements listed in this section are good to know for anyone who wants to master all aspects of configuration of the GNU/Linux system. They are, however, treated briefly and frequently refer to the documentation.
zh-CN: 本节列出的细目对希望精通 GNU/Linux 系统配置极有帮助。这里只列出简要的内容，详情仍需参阅文档。

en: Timezone
zh-CN: 时区

en: <primary>timezone</primary>
zh-CN: <primary>时区</primary>

en: <emphasis>BACK TO BASICS</emphasis> Symbolic links
zh-CN: <emphasis>基础知识</emphasis> 符号链接

en: <primary>link</primary><secondary>symbolic</secondary>
zh-CN: <primary>链接</primary><secondary>符号</secondary>

en: <primary>symbolic link</primary>
zh-CN: <primary>符号链接</primary>

en: A symbolic link is a pointer to another file. When you access it, the file to which it points is opened. Removal of the link will not cause deletion of the file to which it points. Likewise, it does not have its own set of permissions, but rather retains the permissions of its target. Finally, it can point to any type of file: directories, special files (sockets, named pipes, device files, etc.), even other symbolic links.
zh-CN: 符号链接是一种指向另一个文件的指针。使用时，被指向的文件就被打开。移除链接不会删除指向的文件。同样的，没有自身的授权，而是使用目标的授权。最后，可以用于任何类型的文件：文件夹、特殊文件 (socket、命名管道、设备文件等)、甚至另一个符号链接。

en: The <command>ln -s <replaceable>target</replaceable> <replaceable>link-name</replaceable></command> command creates a symbolic link, named <replaceable>link-name</replaceable>, pointing to <replaceable>target</replaceable>.
zh-CN: <command>ln -s <replaceable>target</replaceable> <replaceable>link-name</replaceable></command> 命令添加一个符号链接，命名为 <replaceable>link-name</replaceable>，指向 <replaceable>target</replaceable>。

en: If the target does not exist, then the link is “broken” and accessing it will result in an error indicating that the target file does not exist. If the link points to another link, you will have a “chain” of links that turns into a “cycle” if one of the targets points to one of its predecessors. In this case, accessing one of the links in the cycle will result in a specific error (“too many levels of symbolic links”); this means the kernel gave up after several rounds of the cycle.
zh-CN: 若目标不存在，则链接算是 “破损” 且其使用返回错误消息指示目标文件不存在。若链接指向另一个链接，该链接又指向其前一个链接，则该链接的 “链” 形成 “循环”。在这种情况下，使用循环内的任一链接也会得到特定的错误 (“过多层的符号链接”)；经过若干循环后内核会放弃它。

en: When you need to temporarily change the timezone, use the <varname>TZ</varname> environment variable, which takes priority over the configured system default:
zh-CN: 暂时变更时区，可使用 <varname>TZ</varname> 环境变量，它的优先次序在缺省的配置档之前：

en: <emphasis>NOTE</emphasis> System clock, hardware clock
zh-CN: <emphasis>说明</emphasis> 系统时钟，硬件时钟

en: There are two time sources in a computer. A computer's motherboard has a hardware clock, called the “CMOS clock”. This clock is not very precise, and provides rather slow access times. The operating system kernel has its own, the software clock, which it keeps up to date with its own means (possibly with the help of time servers, see <xref linkend="sect.time-synchronization" />). This system clock is generally more accurate, especially since it doesn't need access to hardware variables. However, since it only exists in live memory, it is zeroed out every time the machine is booted, contrary to the CMOS clock, which has a battery and therefore “survives” rebooting or halting of the machine. The system clock is, thus, set from the CMOS clock during boot, and the CMOS clock is updated on shutdown (to take into account possible changes or corrections if it has been improperly adjusted).
zh-CN: 电脑内有两个时间来源。主板有个硬件时钟，称为 “CMOS 时钟”。这个时钟不准，访问的速度慢。操作系统内核有自己的系统时钟，以自己的方式 (可能由时间服务器协助，见 <xref linkend="sect.time-synchronization" />) 保持时间的正确。此系统时钟较为准确，尤其是不需经由硬件变量就能近用。然而，系统时钟只存在于内存，开机就归零，不像 CMOS 时间钟，有电池支持，不受重新开机影响，关机时仍能 “存活”。因此，开机时，由 CMOS 时钟设置系统时钟，关机时更新 CMOS 时钟 (若被不当调整就能修正它)。

en: In practice, there is a problem, since the CMOS clock is nothing more than a counter and contains no information regarding the time zone. There is a choice to make regarding its interpretation: either the system considers it runs in universal time (UTC, formerly GMT), or in local time. This choice could be a simple shift, but things are actually more complicated: as a result of daylight saving time, this offset is not constant. The result is that the system has no way to determine whether the offset is correct, especially around periods of time change. Since it is always possible to reconstruct local time from universal time and the timezone information, we strongly recommend using the CMOS clock in universal time.
zh-CN: 实务上有个问题，因为 CMOS 时钟只是个计数器，未含时区信息。有几个方式选择其解释方式：系统以世界标准时间 (UTC，旧称 GMT)，或当地时间看待。虽然可以简单切换，但却颇为复杂：它的偏移值不是常数。系统无法判断偏移值的正确性，尤其在时区交接。总是在世界标准时间与时区信息之间重组本地时间，强烈推荐使用 CMOS 时间为世界标准时间。

en: Time Synchronization
zh-CN: 时间同步

en: <primary>time synchronization</primary>
zh-CN: <primary>时间同步</primary>

en: <primary>clock</primary><secondary>synchronization</secondary>
zh-CN: <primary>时间</primary><secondary>同步</secondary>

en: Time synchronization, which may seem superfluous on a computer, is very important on a network. Since users do not have permissions allowing them to modify the date and time, it is important for this information to be precise to prevent confusion. Furthermore, having all of the computers on a network synchronized allows better cross-referencing of information from logs on different machines. Thus, in the event of an attack, it is easier to reconstruct the chronological sequence of actions on the various machines involved in the compromise. Data collected on several machines for statistical purposes won't make a great deal of sense if they are not synchronized.
zh-CN: 时间同步，在单机时代是多余，但在网络时代却很重要。用户无权修改日期与时间，所以需要精准的时间以免混乱。尤有甚者，网络上的电脑时间同步后，有助于安排社区工作者透过全球网络互联。受到攻击时，容易依序恢复原来的运作。由多部机器收集来的统计数据，必须有同步的时间，才能发挥作用。

en: <emphasis>BACK TO BASICS</emphasis> NTP
zh-CN: <emphasis>基础知识</emphasis> NTP

en: <primary>NTP</primary><secondary>server</secondary>
zh-CN: <primary>NTP</primary><secondary>服务器</secondary>

en: NTP (Network Time Protocol) allows a machine to synchronize with others fairly accurately, taking into consideration the delays induced by the transfer of information over the network and other possible offsets.
zh-CN: 网络时间协议 (Network Time Protocol, NTP) 可以让机器间相当精准的同步，甚至把网络延迟及其他偏移值列入考量。

en: While there are numerous NTP servers on the Internet, the more popular ones may be overloaded. This is why we recommend using the <emphasis>pool.ntp.org</emphasis> NTP server, which is, in reality, a group of machines that have agreed to serve as public NTP servers. You could even limit use to a sub-group specific to a country, with, for example, <emphasis>us.pool.ntp.org</emphasis> for the United States, or <emphasis>ca.pool.ntp.org</emphasis> for Canada, etc.
zh-CN: 互联网上很多 NTP 服务器可用，受欢迎的其工作量可能负荷过重。所以推荐使用 <emphasis>pool.ntp.org</emphasis> NTP 服务器，它是一组公开的 NTP 服务器。也可使用针对特定地区的次群组服务器，如 <emphasis>us.pool.ntp.org</emphasis> 系供美国使用、<emphasis>ca.pool.ntp.org</emphasis> 供加拿大使用。

en: However, if you manage a large network, it is recommended that you install your own NTP server, which will synchronize with the public servers. In this case, all the other machines on your network can use your internal NTP server instead of increasing the load on the public servers. You will also increase homogeneity with your clocks, since all the machines will be synchronized on the same source, and this source is very close in terms of network transfer times.
zh-CN: 然而，管理大型网络时，还推荐安装与公共服务器同步的自己 NTP 服务器。同个网络上自己的机器，就能使用内部的 NTP 服务器不必增加外部公共服务器的负担。以自己的时钟增加网络内机器的同质化，同步截取与共用资源，使用共同的网络交换时间。

en: For Workstations
zh-CN: 工作站

en: Since work stations are regularly rebooted (even if only to save energy), synchronizing them by NTP at boot is enough. To do so, simply install the <emphasis role="pkg">ntpdate</emphasis> package. You can change the NTP server used if needed by modifying the <filename>/etc/default/ntpdate</filename> file.
zh-CN: 工作站经常需要重新开机 (虽然只是节省能源)，开机时以 NTP 同步就够了。安装 <emphasis role="pkg">ntpdate</emphasis> 软件包就可以。需要更换 NTP 服务器时，再修改 <filename>/etc/default/ntpdate</filename> 文件即可。

en: For Servers
zh-CN: 服务器

en: Servers are only rarely rebooted, and it is very important for their system time to be correct. To permanently maintain correct time, you would install a local NTP server, a service offered in the <emphasis role="pkg">ntp</emphasis> package. In its default configuration, the server will synchronize with <emphasis>pool.ntp.org</emphasis> and provide time in response to requests coming from the local network. You can configure it by editing the <filename>/etc/ntp.conf</filename> file, the most significant alteration being the NTP server to which it refers. If the network has a lot of servers, it may be interesting to have one local time server which synchronizes with the public servers and is used as a time source by the other servers of the network.
zh-CN: 服务器很少重启，系统时间必须绝对精准。为了永久维持时间的正确性，必须安装由 <emphasis role="pkg">ntp</emphasis> 软件包提供的 NPT 服务器。缺省的配置方式系与 <emphasis>pool.ntp.org</emphasis> 同步，且回应本地网络的请求。可以编辑 <filename>/etc/ntp.conf</filename> 文件改变原来的配置，NTP 服务器依照该文件的内容而变更。若有多个服务器，最好有一个本地时间服务器与公共的服务器同步，并做为本地网络其他服务器的同步的依据。

en: <primary>server</primary><secondary>NTP</secondary>
zh-CN: <primary>服务器</primary><secondary>NTP</secondary>

en: <emphasis>GOING FURTHER</emphasis> GPS modules and other time sources
zh-CN: <emphasis>进一步</emphasis> GPS 模块与其他时间来源

en: If time synchronization is particularly crucial to your network, it is possible to equip a server with a GPS module (which will use the time from GPS satellites) or a DCF-77 module (which will sync time with the atomic clock near Frankfurt, Germany). In this case, the configuration of the NTP server is a little more complicated, and prior consultation of the documentation is an absolute necessity.
zh-CN: 如果网络对时间同步极为敏感，最好在服务器安装 GPS 模块 (从GPS卫星获取时间) 或 DCF-77 模块 (与位于德国法兰克福的原子钟同步时间 )。在这种情况下，NTP 服务器的配置就有点复杂，必须参照文档办理。

en: Rotating Log Files
zh-CN: 轮转日志文件

en: <primary>file</primary><secondary>logs, rotation</secondary>
zh-CN: <primary>文件</primary><secondary>日志，轮转</secondary>

en: Log files can grow, fast, and it is necessary to archive them. The most common scheme is a rotating archive: the log file is regularly archived, and only the latest <replaceable>X</replaceable> archives are retained. <command>logrotate</command>, the program responsible for these rotations, follows directives given in the <filename>/etc/logrotate.conf</filename> file and all of the files in the <filename>/etc/logrotate.d/</filename> directory. The administrator may modify these files, if they wish to adapt the log rotation policy defined by Debian. The <citerefentry><refentrytitle>logrotate</refentrytitle> <manvolnum>1</manvolnum></citerefentry> man page describes all of the options available in these configuration files. You may want to increase the number of files retained in log rotation, or move the log files to a specific directory dedicated to archiving them rather than delete them. You could also send them by e-mail to archive them elsewhere.
zh-CN: 日志文件的增长速度很快，需要存档。最常的做法是循环存档：只保留最新的 <replaceable>X</replaceable> 部分。<command>logrotate</command> 是负责循环的程序，根据 <filename>/etc/logrotate.conf</filename> 文件内的配置，把日志文件保存在 <filename>/etc/logrotate.d/</filename> 文件夹内。管理者可以修改该文件，修改 Debian 缺省的循环政策。<citerefentry><refentrytitle>logrotate</refentrytitle> <manvolnum>1</manvolnum></citerefentry> 手册页面描述该配置可用的选项。可以在循环的过程中，增加存档的文件数，或把文件移至指定的文件夹而不是删除它们。也可以电子邮件方式邮寄到别的地方。

en: The <command>logrotate</command> program is executed daily by the <command>cron</command> scheduling program (described in <xref linkend="sect.task-scheduling-cron-atd" />).
zh-CN: <command>logrotate</command> 程序每日运行 <command>cron</command> 调度的要求 (详情见 <xref linkend="sect.task-scheduling-cron-atd" />)。

en: Sharing Administrator Rights
zh-CN: 共享管理员权限

en: <primary>account</primary><secondary>administrator account</secondary>
zh-CN: <primary>帐户</primary><secondary>管理员帐户</secondary>

en: Frequently, several administrators work on the same network. Sharing the root passwords is not very elegant, and opens the door for abuse due to the anonymity such sharing creates. The solution to this problem is the <command>sudo</command> program, which allows certain users to execute certain commands with special rights. In the most common use case, <command>sudo</command> allows a trusted user to execute any command as root. To do so, the user simply executes <command>sudo <replaceable>command</replaceable></command> and authenticates using their personal password.
zh-CN: 数个管理者共同在同个服务器工作。共用同一个root用户密码不是好主意，匿名引发的误用很麻烦。解决方案是使用 <command>sudo</command> 程序，允许用户对特定命令拥有专门的权力。在多数情况下，<command>sudo</command> 允许受信任的用户以root的权限运行命令。用户只需运行 <command>sudo <replaceable>command</replaceable></command> 并以个人的密码通过认证。

en: List of Mount Points
zh-CN: 挂载点清单

en: <primary>point, mount</primary>
zh-CN: <primary>点，挂载</primary>

en: <primary>mount point</primary>
zh-CN: <primary>挂载点</primary>

en: <emphasis>BACK TO BASICS</emphasis> Mounting and unmounting
zh-CN: <emphasis>基础知识</emphasis> 挂载与卸载

en: Some removable devices are automatically mounted when connected, especially when using the GNOME, Plasma or other graphical desktop environments. Others have to be mounted manually by the user. Likewise, they must be unmounted (removed from the file tree). Normal users do not usually have permission to execute the <command>mount</command> and <command>umount</command> commands. The administrator can, however, authorize these operations (independently for each mount point) by including the <literal>user</literal> option in the <filename>/etc/fstab</filename> file.
zh-CN: 有些移动式设备在链接时系统自动挂载，尤其在 GNOME、Plasma 或其他图形桌面环境。有些情况就需要用户手动挂载。同样的，也需要卸载 (从文件树移除)。标准的用户权限不允许运行挂载 <command>mount</command> 与卸载 <command>umount</command> 命令。只有管理者才能够设置 <filename>/etc/fstab</filename> 文件内的 <literal>user</literal> 选项，授权用户运行该等命令 (独立于每个挂载点)。

en: mount point: this is the location on the local filesystem where the device, remote system, or partition will be mounted.
zh-CN: mount point：这是把设备、远程系统或分区挂载到本地文件系统的位置。

en: type: this field defines the filesystem used on the mounted device. <literal>ext4</literal>, <literal>ext3</literal>, <literal>vfat</literal>, <literal>ntfs</literal>, <literal>btrfs</literal>, <literal>xfs</literal> are a few examples.
zh-CN: type：这个字段定义挂载设备使用的文件系统。<literal>ext4</literal>、<literal>ext3</literal>、<literal>vfat</literal>、<literal>ntfs</literal>、<literal>btrfs</literal>、<literal>xfs</literal> 等。

en: <emphasis>BACK TO BASICS</emphasis> NFS, a network filesystem
zh-CN: <emphasis>基础知识</emphasis> NFS，网络文件系统

en: NFS is a network filesystem; under Linux, it allows transparent access to remote files by including them in the local filesystem.
zh-CN: NFS 是一种 Linux 环境下的网络文件系统，把远程的文件以透明方式纳入本地的文件系统内。

en: options: there are many of them, depending on the filesystem, and they are documented in the <command>mount</command> man page. The most common are
zh-CN: options：依文件系统的不同，而有多种选项，详情见 <command>mount</command> 手册页面。最常用的是

en: <literal>rw</literal> or <literal>ro</literal>, meaning, respectively, that the device will be mounted with read/write or read-only permissions.
zh-CN: <literal>rw</literal> 或 <literal>ro</literal>，表示该设备挂载后可以读/写，或只有读取的权限。

en: <literal>noauto</literal> deactivates automatic mounting on boot.
zh-CN: <literal>noauto</literal> 开机时关闭自动挂载。

en: <literal>nofail</literal> allows the boot to proceed even when the device is not present. Make sure to put this option for external drives that might be unplugged when you boot, because <command>systemd</command> really ensures that all mount points that must be automatically mounted are actually mounted before letting the boot process continue to its end. Note that you can combine this with <literal>x-systemd.device-timeout=5s</literal> to tell <command>systemd</command> to not wait more than 5 seconds for the device to appear (see <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
zh-CN: <literal>nofail</literal> 允许在启动时处理设备，即使该设备不存在。确认启动时，该外置磁盘机可能未插入，因为 <command>systemd</command> 将确认所有挂载点在启动完成前必须自动挂载。可将此与 <literal>x-systemd.device-timeout=5s</literal> 并用，告诉 <command>systemd</command> 不必等 5 秒以上的时间，直接进入下个作业阶段 (见 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>)。

en: <literal>user</literal> authorizes all users to mount this filesystem (an operation which would otherwise be restricted to the root user).
zh-CN: <literal>user</literal> 授权所有的用户均可挂载此文件系统 (若无此选项，则只有根用户才有此权限)。

en: <literal>defaults</literal> means the group of default options: <literal>rw</literal>, <literal>suid</literal>, <literal>dev</literal>, <literal>exec</literal>, <literal>auto</literal>, <literal>nouser</literal> and <literal>async</literal>, each of which can be individually disabled after <literal>defaults</literal> by adding <literal>nosuid</literal>, <literal>nodev</literal> and so on to block <literal>suid</literal>, <literal>dev</literal> and so on. Adding the <literal>user</literal> option reactivates it, since <literal>defaults</literal> includes <literal>nouser</literal>.
zh-CN: <literal>defaults</literal> 表示缺省的选项群组为：<literal>rw</literal>、<literal>suid</literal>、<literal>dev</literal>、<literal>exec</literal>、<literal>auto</literal>、<literal>nouser</literal> 与 <literal>async</literal>，使用了 <literal>defaults</literal> 之后，还可以用 <literal>nosuid</literal> 命令、<literal>nodev</literal> 及其他类似的命令，中止 <literal>suid</literal>、<literal>dev</literal> 等作用。加入 <literal>user</literal> 选项可再启用它，因为 <literal>defaults</literal> 包括 <literal>nouser</literal>。

en: pass: this last field indicates whether the integrity of the filesystem should be checked on boot, and in which order this check should be executed. If it is <literal>0</literal>, no check is conducted. The root filesystem should have the value <literal>1</literal>, while other permanent filesystems get the value <literal>2</literal>.
zh-CN: pass：最后一个字段告知系统在启动时，或其他时机，检查文件系统的完整性。若设为 <literal>0</literal>，则不检查。根文件系统的值为 <literal>1</literal>，其他固定文件系统的值为 <literal>2</literal>。

en: Example <filename>/etc/fstab</filename> file
zh-CN: 范例 <filename>/etc/fstab</filename> 文件

en: <emphasis>GOING FURTHER</emphasis> Auto-mounting
zh-CN: <emphasis>进一步</emphasis> 自动挂载

en: Other auto-mounting utilities exist, such as <command>automount</command> in the <emphasis role="pkg">autofs</emphasis> package or <command>amd</command> in the <emphasis role="pkg">am-utils</emphasis> package.
zh-CN: 还有其他自动挂载实用程序，诸如 <emphasis>autof role="pkg">autofs</emphasis> 软件包中的 <command>automount</command> 或 <emphasis role="pkg">am-utils</emphasis> 软件包中的<command>amd</command>。

en: <command>locate</command> and <command>updatedb</command>
zh-CN: <command>locate</command> 与 <command>updatedb</command>

en: Compiling a Kernel
zh-CN: 编译内核

en: <primary>compilation</primary><secondary>of a kernel</secondary>
zh-CN: <primary>编译</primary><secondary>内核</secondary>

en: <primary>kernel</primary><secondary>compilation</secondary>
zh-CN: <primary>内核</primary><secondary>编译</secondary>

en: The kernels provided by Debian include the largest possible number of features, as well as the maximum of drivers, in order to cover the broadest spectrum of existing hardware configurations. This is why some users prefer to recompile the kernel in order to only include what they specifically need. There are two reasons for this choice. First, it may be to optimize memory consumption, since the kernel code, even if it is never used, occupies memory for nothing (and never “goes down” on the swap space, since it is actual RAM that it uses), which can decrease overall system performance. A locally compiled kernel can also limit the risk of security problems since only a fraction of the kernel code is compiled and run.
zh-CN: Debian 的内核尽量纳入所有的功能，以及最多的驱动程序，以便涵盖现在的硬件配置。所以，有些用户宁愿自行编译只包括所需的内核。这么做有两个理由。第一，内存用量较小，内核代码即使未用到，也占有内存的空间 (而且永远不 “离开” 置换内存，因为它用到实际的 RAM)，降低系统的整体性能。本地自行编译的内核也限制了安全问题的范围，因为只编译与运行部分内核码。

en: <emphasis>NOTE</emphasis> Security updates
zh-CN: <emphasis>说明</emphasis> 安全更新

en: If you choose to compile your own kernel, you must accept the consequences: Debian cannot ensure security updates for your custom kernel. By keeping the kernel provided by Debian, you benefit from updates prepared by the Debian Project's security team.
zh-CN: 决定编译自己的内核后，必须接受一个事实：Debian 不能确认定制内核的安全更新。使用 Debian 的内核，可以使用 Debian 计划提供的更新。

en: Recompilation of the kernel is also necessary if you want to use certain features that are only available as patches (and not included in the standard kernel version).
zh-CN: 使用只在补丁内提供的功能 (不在标准的内核版本内) 时，就必须重新编译内核。

en: <emphasis>GOING FURTHER</emphasis> The Debian Kernel Handbook
zh-CN: <emphasis>进一步</emphasis> The Debian Kernel Handbook

en: The Debian kernel team maintains the “Debian Kernel Handbook” (also available in the <emphasis role="pkg">debian-kernel-handbook</emphasis> package) with comprehensive documentation about most kernel related tasks and about how official Debian kernel packages are handled. This is the first place you should look into if you need more information than what is provided in this section. <ulink type="block" url="https://kernel-team.pages.debian.net/kernel-handbook/" />
zh-CN: Debian 内核团队维护的 “Debian Kernel Handbook” (全文见 <emphasis role="pkg">debian-kernel-handbook</emphasis> 软件包) 详述内核相关的工作与 Debian 内核软件包的处理方式。欲知本节所述事宜的详情，请参见此网址。<ulink type="block" url="https://kernel-team.pages.debian.net/kernel-handbook/" />

en: Introduction and Prerequisites
zh-CN: 简介和先决条件

en: Unsurprisingly Debian manages the kernel in the form of a package, which is not how kernels have traditionally been compiled and installed. Since the kernel remains under the control of the packaging system, it can then be removed cleanly, or deployed on several machines. Furthermore, the scripts associated with these packages automate the interaction with the bootloader and the initrd generator.
zh-CN: Debian 以软件包方式管理内核，与传统的编译安装不同。内核还是在软件包系统的控制下，可以被完整移除，或布建在多个机器上。与该软件包有关的脚本自动与启动程序和 initrd 生成器交互。

en: <emphasis>CULTURE</emphasis> The good old days of <emphasis role="pkg">kernel-package</emphasis>
zh-CN: <emphasis>文化</emphasis> <emphasis role="pkg">kernel-package</emphasis> 的美好岁月

en: Before the Linux build system gained the ability to build proper Debian packages, the recommended way to build such packages was to use <command>make-kpkg</command> from the <emphasis role="pkg">kernel-package</emphasis> package.
zh-CN: 在 Linux 构建系统能够创建适当的 Debian 软件包前，构建这样软件包的推荐方式，是使用来自 <emphasis role="pkg">kernel-package</emphasis> 软件包的 <command>make-kpkg</command>。

en: Getting the Sources
zh-CN: 获取源代码

en: <primary>Linux kernel sources</primary>
zh-CN: <primary>Linux 内核源代码</primary>

en: <primary>kernel</primary><secondary>sources</secondary>
zh-CN: <primary>内核</primary><secondary>源代码</secondary>

en: <primary>source</primary><secondary>of the Linux kernel</secondary>
zh-CN: <primary>源代码</primary><secondary> Linux 内核</secondary>

en: Like anything that can be useful on a Debian system, the Linux kernel sources are available in a package. To retrieve them, just install the <emphasis role="pkg">linux-source-<replaceable>version</replaceable></emphasis> package. The <command>apt search ^linux-source</command> command lists the various kernel versions packaged by Debian. The latest version is available in the <emphasis role="distribution">Unstable</emphasis> distribution: you can retrieve them without much risk (especially if your APT is configured according to the instructions of <xref linkend="sect.apt-mix-distros" />). Note that the source code contained in these packages does not correspond precisely with that published by Linus Torvalds and the kernel developers; like all distributions, Debian applies a number of patches, which might (or might not) find their way into the upstream version of Linux. These modifications include backports of fixes/features/drivers from newer kernel versions, new features not yet (entirely) merged in the upstream Linux tree, and sometimes even Debian specific changes.
zh-CN: 就像 Debian 系统内其他有用的东西，Linux 内核源代码也在软件包内。只要安装 <emphasis role="pkg">linux-source-<replaceable>version</replaceable></emphasis> 软件包，就能取得全部的源代码。<command>apt search ^linux-source</command> 命令列出 Debian 内各种版本的核心软件包。最新的版本在 <emphasis role="distribution">Unstable</emphasis> 发行版内：可以毫不费力的取得 (尤其是把 APT 根据 <xref linkend="sect.apt-mix-distros" /> 的指示配置后)。这些软件包内的源代码并未完全吻合 Linus Torvalds 与其他核心开发者发布的内容；如同其他的发行版，Debian 以一系列的补丁搭配，这些补丁可能 (或不可能) 以自己的方法纳入 Linux 上游的版本。包括从较新核心版本的 fixes/features/drivers 反向迁移，功能较新但尚未 (全部) 合并入上游的Linux 树，甚至 Debian 特别的改变。

en: <emphasis>CULTURE</emphasis> Location of kernel sources
zh-CN: <emphasis>文化</emphasis> 内核源代码的位置

en: Traditionally, Linux kernel sources would be placed in <filename>/usr/src/linux/</filename> thus requiring root permissions for compilation. However, working with administrator rights should be avoided when not needed. There is a <literal>src</literal> group that allows members to work in this directory, but working in <filename>/usr/src/</filename> should be avoided, nevertheless. By keeping the kernel sources in a personal directory, you get security on all counts: no files in <filename>/usr/</filename> unknown to the packaging system, and no risk of misleading programs that read <filename>/usr/src/linux</filename> when trying to gather information on the used kernel.
zh-CN: 传统上，Linux 内核源代码放置于 <filename>/usr/src/linux/</filename>，需要root权限才能编译。但是，在不需要时应避免使用管理员权限。<literal>src</literal> 群组的成员也可以使用该文件夹，但是应避免使用 <filename>/usr/src/</filename>。把核心源代码置于个人文件夹时，应把安全放在第一位：在 <filename>/usr/</filename> 内的文件都应明确其在软件包系统内的作用，试图收集内核使用的信息时，不能在读取 <filename>/usr/src/linux</filename> 时误导程序。

en: Configuring the Kernel
zh-CN: 配置内核

en: <primary>kernel</primary><secondary>configuration</secondary>
zh-CN: <primary>内核</primary><secondary>配置</secondary>

en: <primary>configuration</primary><secondary>of the kernel</secondary>
zh-CN: <primary>配置</primary><secondary>内核</secondary>

en: The next step consists of configuring the kernel according to your needs. The exact procedure depends on the goals.
zh-CN: 下一个步骤是根据需要配置内核。确切的进程视需要而订。

en: Unless you need to change the configuration, you can stop here and skip to <xref linkend="sect.kernel-build" />. If you need to change it, on the other hand, or if you decide to reconfigure everything from scratch, you must take the time to configure your kernel. There are various dedicated interfaces in the kernel source directory that can be used by calling the <command>make <replaceable>target</replaceable></command> command, where <replaceable>target</replaceable> is one of the values described below.
zh-CN: 需要改变配置的话，就跳至 <xref linkend="sect.kernel-build" />。或者从基本开始重新配置，就需花时间配置内核。在内核源代码的文件夹内有很多专属接口，使用 <command>make <replaceable>target</replaceable></command> 命令调用，<replaceable>target</replaceable> 是下列的值之一。

en: When using one of those configuration interfaces, it is always a good idea to start from a reasonable default configuration. The kernel provides such configurations in <filename>arch/<replaceable>arch</replaceable>/configs/*_defconfig</filename> and you can put your selected configuration in place with a command like <command>make x86_64_defconfig</command> (in the case of a 64-bit PC) or <command>make i386_defconfig</command> (in the case of a 32-bit PC).
zh-CN: 使用这些配置界面时，建议从合理的缺省配置开始。提供该配置的内核在 <filename>arch/<replaceable>arch</replaceable>/configs/*_defconfig</filename>，然后使用 <command>make x86_64_defconfig</command> (64 位电脑) 或 <command>make i386_defconfig</command> (32 位电脑) 这样的命令选择合适的缺省配置。

en: <emphasis>TIP</emphasis> Dealing with outdated <filename>.config</filename> files
zh-CN: <emphasis>秘诀</emphasis> 处理过时的 <filename>.config</filename> 文件

en: When you provide a <filename>.config</filename> file that has been generated with another (usually older) kernel version, you will have to update it. You can do so with <command>make oldconfig</command>, it will interactively ask you the questions corresponding to the new configuration options. If you want to use the default answer to all those questions you can use <command>make olddefconfig</command>. With <command>make oldnoconfig</command>, it will assume a negative answer to all questions.
zh-CN: 使用其他 (通常是较旧的) 内核版本的 <filename>.config</filename> 文件时，需要先更新它。可以使用 <command>make oldconfig</command> 命令，以交互方式询问对新配置的选择。可以用 <command>make olddefconfig</command> 命令使用问题缺省的答案。以 <command>make oldnoconfig</command> 命令，可以对问题提供缺省的答案。

en: Compiling and Building the Package
zh-CN: 编译与创建软件包

en: <emphasis>NOTE</emphasis> Clean up before rebuilding
zh-CN: <emphasis>说明</emphasis> 创建前先清理

en: Compiling External Modules
zh-CN: 编译外部模块

en: <primary>kernel</primary><secondary>external modules</secondary>
zh-CN: <primary>内核</primary><secondary>外部模块</secondary>

en: <primary>modules</primary><secondary>external kernel modules</secondary>
zh-CN: <primary>模块</primary><secondary>外部内核模块</secondary>

en: These packages are many and varied, <command>apt-cache rdepends module-assistant$</command> can show the list provided by Debian. However, a complete list isn't particularly useful since there is no particular reason for compiling external modules except when you know you need it. In such cases, the device's documentation will typically detail the specific module(s) it needs to function under Linux.
zh-CN: 这些软件包极多且复杂，<command>apt-cache rdepends module-assistant$</command> 可以列出Debian提供的部分。然而，完整的清单没什么用处，只有明确知道需要时，才会编译特定的外部模块。在这个情况下，设备的文档会详述 Linux 环境所需的模块。

en: <emphasis>ALTERNATIVE</emphasis> module-assistant
zh-CN: <emphasis>其他</emphasis> module-assistant

en: Before DKMS, <emphasis role="pkg">module-assistant</emphasis> was the simplest solution to build and deploy kernel modules. It can still be used, in particular for packages lacking DKMS integration: with a simple command like <command>module-assistant auto-install dadhi</command> (or <command>m-a a-i dahdi</command> for short), the modules are compiled for the current kernel, put in a new Debian package, and that package gets installed on the fly.
zh-CN: DKMS 出现以前，<emphasis role="pkg">module-assistant</emphasis> 是创建与部署内核模块的最简单解决方案。目前还能用，特别是缺少 DKMS 集成的情况：以 <command>module-assistant auto-install dadhi</command> (或较短的 <command>m-a a-i dahdi</command>) 命令，就能编译出给当前内核使用的模块，置于新的 Debian 软件包，让该软件包可以即时安装。

en: Applying a Kernel Patch
zh-CN: 选择内核补丁

en: <primary>kernel</primary><secondary>patch</secondary>
zh-CN: <primary>内核</primary><secondary>补丁</secondary>

en: <primary>patch of the kernel</primary>
zh-CN: <primary>内核补丁</primary>

en: Some features are not included in the standard kernel due to a lack of maturity or to some disagreement with the kernel maintainers. Such features may be distributed as patches that anyone is then free to apply to the kernel sources.
zh-CN: 因为不够成熟或内核维护者意见不一致，很多功能未列入标准的内核。这种功能就以补丁的形式发行，任何人都可以自由地把它纳入内核源代码。

en: Debian sometimes provides some of these patches in <emphasis role="pkg">linux-patch-*</emphasis> packages, but they often don't make it into stable releases (sometimes for the very same reasons that they are not merged into the official upstream kernel). These packages install files in the <filename>/usr/src/kernel-patches/</filename> directory.
zh-CN: Debian 以 <emphasis role="pkg">linux-patch-*</emphasis> 的形式提供这些软件包，但通常不在稳定版中（有时相同的原因是这些都未纳入上游内核版本中）。这些软件包安装的文件在 <filename>/usr/src/kernel-patches/</filename> 文件夹内。

en: Note that a given patch may not necessarily work with every version of the kernel; it is possible for <command>patch</command> to fail when applying them to kernel sources. An error message will be displayed and give some details about the failure; in this case, refer to the documentation available in the Debian package of the patch (in the <filename>/usr/share/doc/linux-patch-*/</filename> directory). In most cases, the maintainer indicates for which kernel versions their patch is intended.
zh-CN: 有些补丁不见得适用于每个内核版本；以 <command>patch</command> 可能无法应用于内核源代码。将出现错误消息且提示错误的原因；在此情况下，参照 Debian 补丁软件包的文档 (位于 <filename>/usr/share/doc/linux-patch-*/</filename> 文件夹)。大部分的情况下，维护者会指出其补丁适用的内核版本。

en: Installing a Kernel
zh-CN: 安装内核

en: <primary>installation</primary><secondary>of a kernel</secondary>
zh-CN: <primary>安装</primary><secondary>内核</secondary>

en: <primary>kernel</primary><secondary>installation</secondary>
zh-CN: <primary>内核</primary><secondary>安装</secondary>

en: Features of a Debian Kernel Package
zh-CN: Debian 内核包特性

en: A Debian kernel package installs the kernel image (<filename>vmlinuz-<replaceable>version</replaceable></filename>), its configuration (<filename>config-<replaceable>version</replaceable></filename>) and its symbols table (<filename>System.map-<replaceable>version</replaceable></filename>) in <filename>/boot/</filename>. The modules are installed in the <filename>/lib/modules/<replaceable>version</replaceable>/</filename> directory.
zh-CN: Debian 内核软件包安装内核映像 (<filename>vmlinuz-<replaceable>version</replaceable></filename>)、其配置 (<filename>config-<replaceable>version</replaceable></filename>) 与符号表 (<filename>System.map-<replaceable>version</replaceable></filename>) 到 <filename>/boot/</filename> 内。其模块安装在 <filename>/lib/modules/<replaceable>version</replaceable>/</filename> 文件夹。

en: <emphasis>CULTURE</emphasis> The symbols table
zh-CN: <emphasis>文化</emphasis> 符号表

en: The symbols table helps developers understand the meaning of a kernel error message; without it, kernel “oopses” (an “oops” is the kernel equivalent of a segmentation fault for user-space programs, in other words messages generated following an invalid pointer dereference) only contain numeric memory addresses, which is useless information without the table mapping these addresses to symbols and function names.
zh-CN: 符号表协助开发者了解核心错误消息的意义；少了心，核心 “oopses” (“oops” 是相当于给用户程序的核心区段错误，换句话说，消息加上错误指针) 只有数字内存地址，没有符号表映射该等地址至符号与功能的话，本身是无意义的。

en: Most of those tasks are offloaded to hook scripts in the <filename>/etc/kernel/*.d/</filename> directories. For instance, the integration with <command>grub</command> relies on <filename>/etc/kernel/postinst.d/zz-update-grub</filename> and <filename>/etc/kernel/postrm.d/zz-update-grub</filename> to call <command>update-grub</command> when kernels are installed or removed.
zh-CN: 大部分的这些工作卸载至 <filename>/etc/kernel/*.d/</filename> 文件夹内的脚本。例如，当已安装或移除内核时，集成 <command>grub</command> 于 <filename>/etc/kernel/postinst.d/zz-update-grub</filename> 和 <filename>/etc/kernel/postrm.d/zz-update-grub</filename> 调用 <command>update-grub</command>。

en: Installing with <command>dpkg</command>
zh-CN: 使用 <command>dpkg</command> 安装

en: The configuration steps described in this chapter are basic and can lead both to a server system or a workstation, and it can be massively duplicated in semi-automated ways. However, it is not enough by itself to provide a fully configured system. A few pieces are still in need of configuration, starting with low-level programs known as the “Unix services”.
zh-CN: 本章描述供服务器系统或工作站的基本配置，可以用半自动的方式大量复制。然而，本身还不足以提供完整的配置系统。还有若干部分需要进一步的配置，从 “Unix 服务” 之类的低级程序开始。
