How to Set Up System Locale on AlmaLinux 9

The system locale or the locale setting on Linux will help us to ensure the date and time information are displayed in the correct format according to the location where the user is living and the language spoken.

In this tutorial, we are going to show you how to set up system locale on AlmaLinux 9 OS.

Lucky to all Linux users, every Linux operating system comes with multiple language support that can be easily switched with one command.

Setting up system locales on AlmaLinux 9 is a very easy process that can be made with a couple of steps. Let’s get started!

Prerequisites

  • A server with AlmaLinux 9 as OS
  • User privileges: root or non-root user with sudo privileges

Update the System

Every fresh installation of AlmaLinux, needs the packages to be updated to their latest versions available. To do that, execute the following command:

sudo dnf update -y && sudo dnf upgrade -y

Show Current Settings

To show the current settings on your system, execute the following command:

localectl

You should receive output similar to this.

[root@host ~]# localectl
System Locale: LANG=en_US.UTF-8

As you can see, the Language setting is set to English-speaker users in the United States. The UTF-8 is a variable-length character encoding standard used for electronic communication. Defined by the Unicode Standard, the name is derived from Unicode Transformation Format – 8-bit

Let’s move to the next paragraph and learn how to list the system locales.

List Supported Languages

To list the available language support, execute the following command:

localectl list-locales

You should receive the following output:

[root@host ~]# localectl list-locales
C.UTF-8
aa_DJ.UTF-8
aa_ER.UTF-8
aa_ER.UTF-8@saaho
aa_ET.UTF-8
af_ZA.UTF-8
agr_PE.UTF-8
ak_GH.UTF-8
am_ET.UTF-8
an_ES.UTF-8
anp_IN.UTF-8
ar_AE.UTF-8
ar_BH.UTF-8
ar_DZ.UTF-8
ar_EG.UTF-8
   .
   .
   .
   .

As you can see, the language options are in alphabetical order. To find, for example, some specific language, you can use the same command with the grep command:

localectl list-locales | grep US

The command above will return the following output:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
[root@host ~]# localectl list-locales | grep US
chr_US.UTF-8
en_US.UTF-8
es_US.UTF-8
unm_US.UTF-8
yi_US.UTF-8

This command with grep and specifying the shortcut of the country will return all locales for that country. Let’s move to the next and most important paragraph of this tutorial.

Set up System Locale

In this step, we will provide you with the exact command to change (set up) the system locale. Feel free to execute the following command:

localectl set-local unm_US.UTF-8

This will change the locale on your server. Now, if you executed the localectl command before and after setting up the system locale on your server, you would get the following output:

[root@host ~]# localectl
System Locale: LANG=en_US.UTF-8
    VC Keymap: us
   X11 Layout: us
[root@host ~]# localectl set-locale unm_US.UTF-8
[root@host ~]# localectl
System Locale: LANG=unm_US.UTF-8
    VC Keymap: us
   X11 Layout: us
[root@host ~]#

As you can see, the locale has been changed from LANG=en_US.UTF-8 TO LANG=unm_US.UTF-8

More about localectl

If you want to learn more about the localectl command, you need to execute the man localectl on your command prompt.

[root@host ~]# man localectl
LOCALECTL(1)                                                                 localectl                                                                 LOCALECTL(1)

NAME
       localectl - Control the system locale and keyboard layout settings

SYNOPSIS
       localectl [OPTIONS...] {COMMAND}

DESCRIPTION
       localectl may be used to query and change the system locale and keyboard layout settings. It communicates with systemd-localed(8) to modify files such as
       /etc/locale.conf and /etc/vconsole.conf.

       The system locale controls the language settings of system services and of the UI before the user logs in, such as the display manager, as well as the
       default for users after login.

       The keyboard settings control the keyboard layout used on the text console and of the graphical UI before the user logs in, such as the display manager, as
       well as the default for users after login.

       Note that the changes performed using this tool might require the initrd to be rebuilt to take effect during early system boot. The initrd is not rebuilt
       automatically by localectl, this task has to be performed manually, usually using a tool like dracut(8).

       Note that systemd-firstboot(1) may be used to initialize the system locale for mounted (but not booted) system images.

COMMANDS
       The following commands are understood:

       status
           Show current settings of the system locale and keyboard mapping. If no command is specified, this is the implied default.

       set-locale LOCALE, set-locale VARIABLE=LOCALE...
           Set the system locale. This takes one locale such as "en_US.UTF-8", or takes one or more locale assignments such as "LANG=de_DE.utf8",
           "LC_MESSAGES=en_GB.utf8", and so on. If one locale without variable name is provided, then "LANG=" locale variable will be set. See locale(7) for
           details on the available settings and their meanings. Use list-locales for a list of available locales (see below).

       list-locales
           List available locales useful for configuration with set-locale.

That’s it. You successfully set up the system locale on AlmaLinux 9 OS. Of course, you do not have to do this if you find it difficult. You can always contact our technical support and they will help you with any aspect of the system locale. All you need to do is to sign up for one of our Linux VPS plans and submit a support ticket. We are available 24/7.

If you liked this about setting up the system locale on AlmaLinux 9, please share it with your friends on social networks using the buttons on the left or simply leave a reply below.

Leave a Comment