centos7设置中文输入法-中文乱码篇

  • Post author:
  • Post category:其他


前言:由于早上想安装一下vsftpd的(我知道已经过时了,但是我还是觉得蛮实用的),但是呢,出现了中文乱码的情况,因为我使用的远程工具支持的是中文,所以我英文的系统会出现乱码,很快啊,我就找到一个博主的教程更换了语言,博主文章链接我贴下面一行~~


博主教程链接,我只属于转载如果博主不同意的话,会联系我删除,勿介~~

教程准备:

centos7.9 MIni 英文

乱码图展示如下:

在这里插入图片描述

解决方案:

1、查看系统中是否有中文语言

[root@xiaohui ~]# locale -a | grep zh_CN*
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

2、安装中文语言环境

[root@xiaohui ~]# yum install kde-l10n-Chinese -y

3、设置环境变量

[root@xiaohui ~]# vim /etc/profile
#在文件末尾追加一条
export LC_ALL="zh_CN.UTF-8"
[root@xiaohui ~]# source /etc/profile

#可能会出现这如下提示可忽略
-bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.UTF-8)
-bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.UTF-8)

再次使用locale查看确认支持中文

[root@xiaohui ~]# locale
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_ALL to default locale: No such file or directory
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.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=zh_CN.UTF-8

4、设置locale.conf文件

[root@xiaohui ~]# vim /etc/locale.conf
#将内容LANG="en_US.UTF-8"修改为如下
LANG="zh_CN.UTF-8"
[root@xiaohui ~]# source /etc/locale.conf

5、设置系统语言

[root@xiaohui ~]# localedef -c -f UTF-8 -i zh_CN zh_CN.utf8

大功告成~ 咱们上一下设置成功的截图~ 芜湖~~

在这里插入图片描述