👋 欢迎来到吴老二技术博客,专注运维 / 数据库 / 云原生
首页/运维服务/正文

linux登录报错LC_ALL: cannot change locale (en_US.UTF-8)

吴
吴老二
2022-10-15运维服务2138 次浏览0 条评论
今天安装了一个centos8,安装的时候选择的是中文版,以前都是使用的英文版,英文版的好处就是问题相对要少。今天安装的中文版在远程登录时出现报错信息。
-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)
这里的提示是因为中午版的英语没有,所以需要单独安装一下。解决方法如下:
[root@www.wulaoer.org ~]# dnf install -y langpacks-zh_CN langpacks-en langpacks-en_GB
[root@www.wulaoer.org ~]# 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
[root@www.wulaoer.org ~]# source /etc/profile.d/locale.sh
[root@www.wulaoer.org ~]# exit
logout
Connection to 10.211.55.12 closed.
[wolf@wulaoer.org 🔥🔥🔥🔥 ~ ]$ ssh root@10.211.55.12
root@10.211.55.12's password:
[root@www.wulaoer.org ~]#
重新登录后问题解决,在网上也看了其他的方式,不是修改文件就是安装什么的,过于麻烦,这个相对简单点,我也没有试试其他的,这个方式是解决了。
文章底部广告位在后台「广告设置」填写广告代码后显示

评论 0

评论需 登录 后发表(注册并验证邮箱)。
还没有评论,来抢沙发~