CentOS 8 报错:Failed to set locale, defaulting to C.UTF-8
学习Docker的时间遇到一个问题,发现和视频里教的总是会多出一行
这里会有两种原因
- 系统没有安装对应的语言包
- 没有配置正确的语言环境
一般情况下都是第二种情况居多 首先使用 locale -a 查看已安装的语言包
[root@hecs-131104 data]
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
C.utf8
POSIX
en_AG
en_AU
en_AU.utf8
en_BW
en_BW.utf8
en_CA
en_CA.utf8
en_DK
en_DK.utf8
en_GB
en_GB.iso885915
en_GB.utf8
en_HK
en_HK.utf8
en_IE
en_IE.utf8
en_IE@euro
en_IL
en_IN
en_NG
en_NZ
en_NZ.utf8
en_PH
en_PH.utf8
en_SC.utf8
en_SG
en_SG.utf8
en_US
en_US.iso885915
en_US.utf8
en_ZA
en_ZA.utf8
en_ZM
en_ZW
en_ZW.utf8
这里有en_US.utf8,所以是第二种情况。执行以下命令即可
echo "export LC_ALL=en_US.UTF-8" >> /etc/profile
echo "export LC_CTYPE=en_US.UTF-8" >> /etc/profile
source /etc/profile
再次执行命令,就不报那个问题了
[root@hecs-131104 data]
Last metadata expiration check: 0:18:53 ago on Sat 02 Oct 2021 08:52:23 PM CST.
Package yum-utils-4.0.18-4.el8.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
|