Компьютер с новой инсталляции, созданной с помощью debian-installer
в большинстве случаев функционалены, но некоторые службы требуют определённой настройки. Более того, всегда полезно знать как поменять некоторые настройки, которые были сделаны во время установки системы.
Эта глава освещает все что можно назвать "базовой настройкой": сеть, язык и локали, пользователи и группы, печать, точки монтирования и т. п.
8.1. Настройка другого языка
Если при установке системы был использован французский язык, он будет использован как язык системы по умолчанию. Однако полезно знать как можно его поменять при необходимости.
8.1.1. Установка языка по умолчанию
Локаль представляет собой группу региональных настроек. Они включают в себя не только язык текста, но и формат отображения чисел, дат, времени и денежных сумм, а также алфавитные правила сравнения (чтобы правильно учитывать диакритические знаки). Хотя каждый из этих параметров может быть установлен независимо от остальных, мы обычно используем локаль, которая является согласованным набором значений всех параметров, соответствующих «региону» в самом широком смысле. Локали обычно указаны в форме код-языка_КОД-СТРАНЫ
, а иногда с суффиксом, для указания набора символов и кодировки, которые будут использоваться. Это позволяет решить идиоматические или типографские различия между различными регионами с одинаковым языком.
The locales package includes all the elements required for proper functioning of “localization” of various applications. During installation, this package will ask to select a set of supported languages. This set can be changed at any time by running dpkg-reconfigure locales
as root.
The first question invites you to select “locales” to support. Selecting all English locales (meaning those beginning with “en_
”) 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 /etc/locale.gen
file. It is possible to edit this file by hand, but you should run locale-gen
after any modifications. It will generate the necessary files for the added locales to work, and remove any obsolete files.
The second question, entitled “Default locale for the system environment”, requests a default locale. The recommended choice in the U.S.A. is “en_US.UTF-8
”. British English speakers will prefer “en_GB.UTF-8
”, and Canadians will prefer either “en_CA.UTF-8
” or, for French, “fr_CA.UTF-8
”. The /etc/default/locale
file will then be modified to store this choice. From there, it is picked up by all user sessions since PAM will inject its content in the LANG
environment variable.
8.1.2. Configuring the Keyboard
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 keyboard-configuration package. Thus the dpkg-reconfigure keyboard-configuration
command can be used at any time to reset the keyboard layout.
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
).
Note that the keyboard configuration for graphical mode described here only affects the default layout; the GNOME and KDE 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.
8.1.3. Migrating to 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).