Chapter 2. System Locale and Keyboard Configuration
/etc/locale.conf configuration file or by using the localectl utility. Also, you can use the graphical user interface to perform the task; for a description of this method, see Red Hat Enterprise Linux 7 Installation Guide.
2.1. Setting the System Locale
/etc/locale.conf file, which is read at early boot by the systemd daemon. The locale settings configured in /etc/locale.conf are inherited by every service or user, unless individual programs or individual users override them.
/etc/locale.conf is a newline-separated list of variable assignments. For example, German locale with English messages in /etc/locale.conf looks as follows:
LANG=de_DE.UTF-8 LC_MESSAGES=C
/etc/locale.conf, you can use several other options, the most relevant are summarized in Table 2.1, “Options configurable in /etc/locale.conf”. See the locale(7) manual page for detailed information on these options. Note that the LC_ALL option, which represents all possible options, should not be configured in /etc/locale.conf.
Table 2.1. Options configurable in /etc/locale.conf
| Option | Description |
|---|---|
| LANG | Provides a default value for the system locale. |
| LC_COLLATE | Changes the behavior of functions which compare strings in the local alphabet. |
| LC_CTYPE | Changes the behavior of the character handling and classification functions and the multibyte character functions. |
| LC_NUMERIC | Describes the way numbers are usually printed, with details such as decimal point versus decimal comma. |
| LC_TIME | Changes the display of the current time, 24-hour versus 12-hour clock. |
| LC_MESSAGES | Determines the locale used for diagnostic messages written to the standard error output. |
2.1.1. Displaying the Current Status
localectl command can be used to query and change the system locale and keyboard layout settings. To show the current settings, use the status option:
localectlstatus
Example 2.1. Displaying the Current Status
~]$localectlstatusSystem Locale: LANG=en_US.UTF-8 VC Keymap: us X11 Layout: n/a
2.1.2. Listing Available Locales
localectllist-locales
Example 2.2. Listing Locales
~]$localectllist-locales|grepen_en_AG en_AG.utf8 en_AU en_AU.iso88591 en_AU.utf8 en_BW en_BW.iso88591 en_BW.utf8 output truncated
2.1.3. Setting the Locale
root:
localectlset-localeLANG=locale
localectl list-locales command. The above syntax can also be used to configure parameters from Table 2.1, “Options configurable in /etc/locale.conf”.
Example 2.3. Changing the Default Locale
list-locales. Then, as root, type the command in the following form:
~]#localectlset-localeLANG=en_GB.utf8
2.1.4. Making System Locale Settings Permanent when Installing with Kickstart
%packages section of the Kickstart file includes the --instLang option, the _install_langs RPM macro is set to the particular value for this installation, and the set of installed locales is adjusted accordingly. However, this adjustment affects only this installation, not subsequent upgrades. If an upgrade reinstalls the glibc package, the entire set of locales is upgraded instead of only the locales you requested during the installation.
- If you have not started the Kickstart installation, modify the Kickstart file to include instructions for setting RPM macros globally by applying this procedure: Procedure 2.1, “Setting RPM macros during the Kickstart installation”
- If you have already installed the system, set RPM macros globally on the system by applying this procedure: Procedure 2.2, “Setting RPM macros globally”
Procedure 2.1. Setting RPM macros during the Kickstart installation
- Modify the
%postsection of the Kickstart file:LANG=en_US echo "%_install_langs $LANG" > /etc/rpm/macros.language-conf awk '(NF==0amp amp!done){print "override_install_langs='$LANG'";done=1}{print}' \ < /etc/yum.conf > /etc/yum.conf.new mv /ec/yum.conf.new /etc/yum.conf
Procedure 2.2. Setting RPM macros globally
- Create the RPM configuration file at
/etc/rpm/macros.language-confwith the following contents:%_install_langs LANG
LANG is the value of theinstLangoption. - Update the
/etc/yum.conffile with:override_install_langs=LANG

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.