Product SiteDocumentation Site

第 8 章 基础配置:网络,账户,打印……

8.1. 用其他语言进行配置
8.1.1. 设置默认语言
8.1.2. 键盘配置
8.1.3. 迁移到 UTF-8
8.2. 配置网络
8.2.1. Ethernet Interface
8.2.2. Connecting with PPP through a PSTN Modem
8.2.3. Connecting through an ADSL Modem
8.2.4. Automatic Network Configuration for Roaming Users
8.3. Setting the Hostname and Configuring the Name Service
8.3.1. Name Resolution
8.4. User and Group Databases
8.4.1. User List: /etc/passwd
8.4.2. The Hidden and Encrypted Password File: /etc/shadow
8.4.3. Modifying an Existing Account or Password
8.4.4. Disabling an Account
8.4.5. Group List: /etc/group
8.5. Creating Accounts
8.6. Shell Environment
8.7. Printer Configuration
8.8. Configuring the Bootloader
8.8.1. Identifying the Disks
8.8.2. Configuring LILO
8.8.3. GRUB 2 Configuration
8.8.4. For Macintosh Computers (PowerPC): Configuring Yaboot
8.9. Other Configurations: Time Synchronization, Logs, Sharing Access…
8.9.1. Timezone
8.9.2. Time Synchronization
8.9.3. Rotating Log Files
8.9.4. Sharing Administrator Rights
8.9.5. List of Mount Points
8.9.6. locate and updatedb
8.10. Compiling a Kernel
8.10.1. Introduction and Prerequisites
8.10.2. 获取源代码
8.10.3. Configuring the Kernel
8.10.4. Compiling and Building the Package
8.10.5. Compiling External Modules
8.10.6. 选择内核补丁
8.11. 安装内核
8.11.1. Debian 内核包特性
8.11.2. Installing with dpkg
A computer with a new installation created with debian-installer 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.
这章综述我们称之为“基础配置”所包括的任何事项:网络、语言、地区、用户、用户组、打印、挂载点等。

8.1. 用其他语言进行配置

如果你在法语环境下安装了系统,那么默认语言可能会被设置为法语。所以你最好知道你的安装器使用的是什么语言。如果对语言有要求而又设置错误了,你可以自己进行修改。

8.1.1. 设置默认语言

一个 locale 指一系列的区域设置。它不仅包括对文字语言的设置,也包括数字格式显示、日期、时间和货币,以及“按字母顺序排列规则”(正确地处理重音字符)。虽然这些参数可以被独立配置,我们仍建议您使用 locale 这个从地区形式最大化匹配一连贯参数的工具。这些 locales 一般以以下格式 语言代码_城市代码,有时后缀也在指定字符集和编码中被使用。这是考虑到同一语言在不同区域之间使用习惯和印刷差异。
locales 包括所有应用“本土化”所需要的所有元素。安装过程中,该包将要求使用者选择一系列支持语言。该选择能在使用root帐号运行 dpkg-reconfigure locales 改变。
第一个让您回答的问题是选哪些“ locales ”来支持。选择所有英语国家(所有以en_开始的环境)是一种可能。如果主机上有外国用户,打开对应的语言环境支持不要犹豫。所有在本系统被打开支持的语言环境存储在 /etc/locale.gen 。它可以被手动编辑,但需要在你做任何改动后运行 locale-gen 使改动生效。该命令将创建新添加的语言环境及其关联文件并移除过期的文件。
第二个问题,标题 “系统环境的默认字符环境”请求设置默认的字符系统。该选择在美国是 en_US.UTF-8,英式发音者更习惯于 en_GB.UTF-8 ,加拿大人喜欢 en_CA.UTF-8 或者对于法国人来说 fr_CA.UTF-8/etc/default/locale 文件会保存这个变更。该设置将由 PAM 系统写入到所有登录用户会话的 LANG 环境变量。

8.1.2. 键盘配置

甚至如果键盘布局在终端和图形模式中被设置成不同, Debian 也提供了一个简单的配置让它们两个工作:它基于 debconf 并由keyboard-configuration 包实现。使用 dpkg-reconfigure keyboard-configuration 命令来重新设置键盘布局。
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 Compose ' e and produce an e-acute (“é”). All these combinations are described in the /usr/share/X11/locale/en_US.UTF-8/Compose file (or another file, determined according to the current locale indicated by /usr/share/X11/locale/compose.dir).
注意,该处说明的是默认键盘布局下图形模式的键盘设定; GNOME 和 KDE 等环境,为每一个用户提供一个键位控制面板去设置他们的喜好键位。面板中也能提供一些特殊键位的扩展选项。

8.1.3. 迁移到 UTF-8

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.
As far as file names are concerned, the migration can be relatively simple. The convmv 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 convmv to rename them.
$ ls travail/
Ic?nes  ?l?ments graphiques  Textes
$ convmv -r -f iso-8859-15 -t utf-8 travail/
Starting a dry run without changes...
mv "travail/�l�ments graphiques"        "travail/Éléments graphiques"
mv "travail/Ic�nes"     "travail/Icônes"
No changes to your files done. Use --notest to finally rename the files.
$ convmv -r --notest -f iso-8859-15 -t utf-8 travail/
mv "travail/�l�ments graphiques"        "travail/Éléments graphiques"
mv "travail/Ic�nes"     "travail/Icônes"
Ready!
$ ls travail/
Éléments graphiques  Icônes  Textes
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.
For simple text files, you can use recode (in the package of the same name) which allows automatic recoding. This tool has numerous options so you can play with its behavior. We recommend you consult the documentation, the recode(1) man page, or the recode info page (more complete).