Quick tip: adjust locale settings on CentOS 7 minimal install

0 Flares Twitter 0 Facebook 0 LinkedIn 0 Email -- 0 Flares ×

I’m playing lately with the new CentOS 7. As usual, I prefer to run the minimal install to keep the disk usage at a minimum, and avoid a system loaded with software and services I don’t need. I’m not sure if it’s because of the minimum install mode, but with CentOS 7, as soon as a new system is installed and I run yum, I’m facing everytime this annoying warning message:

Failed to set locale, defaulting to C

So, I figured out a quick way to change the locale settings in CentOS 7.

You just need to create a new configuration file like:

vi /etc/profile.d/locale.sh

In this new file, enter the needed parameters like mine in this case:

export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8

Save the file, and load its parameters using:

source /etc/profile.d/locale.sh

I’ve read around someone is suggesting to edit /etc/bashrc. This is a BAD thing to do, this file can be updated from time to time when updating the system, and I’m not sure a non-default file is not dangerous. Profile.d is your place to go.