作者:日后再曰 | 来源:互联网 | 2023-10-11 15:36
EachtimeISSHtomyFedoraServer,thelocalesettingisnotright.$localelocale:Cannotset
Each time I SSH to my Fedora Server, the locale setting is not right.
$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: ??? LC_ALL ????????: ?????????
LC_CTYPE=UTF-8
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MOnETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHOnE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=
And each time I would have to $ export LC_ALL="zh_CN.UTF-8"
to make the desired language work.
But I have already set LANG=zh_CN.UTF-8
and LC_ALL=zh_CN.UTF-8
in /etc/locale.conf/
and in ~/.bashrc
.
Is there any way I can make the export
permanent? Really appreciate a lot!!
You are missing the export
in your ~/.bashrc
.
export LC_ALL=zh_CN.UTF-8
When you login to your user in the remote server via ssh
, the ~/.bashrc
of that user will get sourced and the locale
will be set.
实例配置:
[root@zhiyi-first-server ~]# cat ~/.bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# added by Anaconda3 installer
export PATH="/root/anaconda3/bin:/root/datainfra/tool/alihbase-1.1.4/bin:$PATH"
# java
export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64/jre"
export LC_ALL=zh_CN.UTF-8