Yum Issue: Failed to Set Locale, defaulting to C

If you get a error or warning message “Failed to set locale, defaulting to C” when using yum command in CentOS or RHEL Linux system, how to fix this problem or how do I avoid getting this warning message.

yum logo

Form the warning message, you should know that the locale variable do not correctly setup on your Linux system. And you need to set the current locale value into your environment variables.

You just need to add the following locale relating setting into the file /etc/profile.d/lang.sh with vim text editor:

$ vim /etc/profile.d/lang.sh
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_COLLATE=C
export LC_CTYPE=en_US.UTF-8

 

save and close the file. And run this file with source command to make changes to take effect.

$ source /etc/profile.d/lang.sh

Then you can check the current locale value for you language with the following command:

$ locate

Outputs:

[root@devops ~]# locale

LANG=en_US.UTF-8

LC_CTYPE="en_US.UTF-8"

LC_NUMERIC="en_US.UTF-8"

LC_TIME="en_US.UTF-8"

LC_COLLATE="en_US.UTF-8"

LC_MONETARY="en_US.UTF-8"

LC_MESSAGES="en_US.UTF-8"

LC_PAPER="en_US.UTF-8"

LC_NAME="en_US.UTF-8"

LC_ADDRESS="en_US.UTF-8"

LC_TELEPHONE="en_US.UTF-8"

LC_MEASUREMENT="en_US.UTF-8"

LC_IDENTIFICATION="en_US.UTF-8"

LC_ALL=

 

 

 

You might also like:

Sidebar



back to top