The system Localeare used to control the language setting of system services and the UI before the user logs in. How does I change the default system locale in the CentOS 7 Linux system? How to check the current locate setting under CentOS 7 or RHEL 7 ? How do I get the list of all available locales on the current Linux system? The This post, you'll see, how to set the system locale.
CentOS 7/rhel 7 Check current System Locale Settings
To show the current locale settings, you can view the "/etc/locale.conf" configuration file via "cat/etc/locale.conf" com Mand or issue the following "Localectl status" command.
1 2 3 |
Cat/etc/locale.conf OR Localectl status |
Output:
1 2 3 4 5 6 |
[root @ devops ~] # cat/etc/locale.conf LANG =es_us.utf8 [root @ devops ~] # LOCALECTL Status System Locale:lang =es_us.utf8 VC Keymap:us X11 Layout:us |
CentOS 7/rhel 7 List all Available Locales
Before changing the system locale, you must know that which locales is available on the current system, issue the FOLLOWI ng command:
Example:if want to select a en_US locale and then you can list all en_US locales by issue the following command:
Localectl List-locales | grep en_US |
Outputs:
1 2 3 4 5 |
[root @ devops ~] # localectl List-locales | grep en_US en_US en_us.iso88591 en_us.iso885915 En_us.utf8 |
CentOS 7/rhel Change the System Locale
There is ways to change the system locale by through modifying the "/etc/locale.conf" configuration file or using a N EW command "Localect" which is newly added in CentOS 7 or RHEL 7 operating system.
Edit "/etc/locale.conf" file using "Vim" command and "search" LANG "line and" it value as "What do you want to select th E locale. Such as:change locale to "en_us.iso88591″.vim/etc/locale.conf
Before:
After:
Save and exit the above configuration file and reboot the system, then the changes would take effect.
# Set the system locale via LOCALECTL command
To set the default system locale and you can use the following command:
Localectl Set-locale LANG = < locale name > |
You need to replace the locale name as your want to select the locale.
Example:changing The default locale to German locale, issue the following command:
Localectl Set-locale LANG =de_de. UTF-8 |
Outputs:
1 2 3 4 5 |
[root @ devops ~] # localectl Set-locale lang=de_de. UTF-8 [root @ devops ~] # LOCALECTL Status System Locale:lang =de_de. UTF-8 VC Keymap:us X11 Layout:us |
Note:you must log on the system with root user to run Localectl command.
CentOS 7/rhel 7:how To change the System Locale