Linux : perl: warning: Setting locale failed

By | January 21, 2017

You probably noticed the following output on your console after logging to your newly installed CloudLinux server :

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = “UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = “UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).

This does not represent any major issue, but can be quite annoying over time. To get rid of these notifications, do the following procedure.

1. Edit the following file using your favorite text editor :

/etc/environment

2. Append the following :

LANGUAGE = "en_US:en",
LC_ALL = "en_US.UTF-8",
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"

NOTE : The file should be blank by default. You may adjust the above to meet your requirements if using different language or encoding.