Locale Error in centos

2019-03-08 04:33发布

问题:

Every time I login to my CentOS 6 server through SSH I get this error

Can anyone please explain what does that error mean & how to fix?

-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory

回答1:

The Fix: Thanks for Millie Smith (https://stackoverflow.com/users/2850543/millie-smith) & http://linuxforums.org.uk/index.php?topic=10318.0

Using root user through ssh

Run these commands

vi /etc/environment

& add these lines:

LANG=en_US.utf-8
LC_ALL=en_US.utf-8


回答2:

I try yum reinstall glibc-common from there and @Seif Hatem's method.

but it don not work.

you can use try this.

It works.

export LANG=en_US.UTF-8
export LC_CTYPE="en_US.UTF-8"
export LC_NUMERIC="en_US.UTF-8"
export LC_TIME="en_US.UTF-8"
export LC_COLLATE="en_US.UTF-8"
export LC_MONETARY="en_US.UTF-8"
export LC_MESSAGES="en_US.UTF-8"
export LC_PAPER="en_US.UTF-8"
export LC_NAME="en_US.UTF-8"
export LC_ADDRESS="en_US.UTF-8"
export LC_TELEPHONE="en_US.UTF-8"
export LC_MEASUREMENT="en_US.UTF-8"
export LC_IDENTIFICATION="en_US.UTF-8"
export LC_ALL=en_US.UTF-8

https://github.com/2creatives/vagrant-centos/issues/7



回答3:

Before connecting to the host via SSH, you can set LC_ALL to C, e.g.

LC_ALL=C ssh user@example.com