CentOS8 -bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) 解决方法

avatar 2023年4月13日18:15:24 评论 213 次浏览

最小化安装的centos8,安装的时候选择的语言是中文,但是安装好后,登录的时候提示"-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)",虽然不影响使用,但是总是感觉别扭。

 [wolf@wulaoer.org 🔥🔥🔥🔥 ~ ]$ ssh root@10.211.55.25
 The authenticity of host '10.211.55.25 (10.211.55.25)' can't be established.
 ED25519 key fingerprint is SHA256:R8dcuRPaSozaIb/JnpoEBYOMq5uVeG2VDmK9tQZlJPQ.
 This key is not known by any other names
 Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
 Warning: Permanently added '10.211.55.25' (ED25519) to the list of known hosts.
 root@10.211.55.25's password:
 -bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
 /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
 /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
 /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
 -bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

每次登录的时候都会这个提示,主要原因是因为没有中文包,需要重新安装一下,然后把中文配置到环境变量中。

 dnf install -y langpacks-zh_CN langpacks-en langpacks-en_GB
  
 cat >/etc/profile.d/locale.sh<<-EOF
 export LANG=en_US.UTF-8
 export LANGUAGE=en_US.UTF-8
 export LC_COLLATE=C
 export LC_CTYPE=en_US.UTF-8
 EOF
  
 source /etc/profile.d/locale.sh

配置后,退出重新登录,异常解决,没有了。

avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: