这里是普通文章模块栏目内容页
Centos yum命令提示failed to set locale, defaulting to C

Centos yum命令提示failed to set locale, defaulting to C.UTF-8

问题

在输入yum命令是出现

Failed to set locale, defaulting to C

出现这个问题是由于系统没有正确设置locale环境, 而locale是用于设置本地环境的比如:语言、时区、数字等

locale提示

运行locale命令会出现如下提示

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

解决方案

方案一:设置系统环境变量

echo "export LC_ALL=en_US.UTF-8"  >>  /etc/profile
source /etc/profile

方案二:设置个人环境变量

echo "export LC_ALL=en_US.UTF-8"  >>  ~/.bashrc
source ~/.bashrc

 或者

echo "export LC_ALL=en_US.UTF-8" >> /etc/profile
echo "export LC_CTYPE=en_US.UTF-8" >> /etc/profile