心溢 發表於 2024-6-7 00:00:00

CentOS终端命令行显示中文乱码的解决方法

<p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;">
        安装CentOS的时候选择了中文,结果在终端不能显示中文,都是乱码,解决方法:<br/>
        修改/etc/sysconfig/i18n,内容为<br/></p><pre class="brush:plain;toolbar:false">LANG=&quot;zh_CN.GB18030&quot;
LANGUAGE=&quot;zh_CN.GB18030:zh_CN.GB2312:zh_CN&quot;
SUPPORTED=&quot;zh_CN.UTF-8:zh_CN:zh:en_US.UTF-8:en_US:en&quot;
SYSFONT=&quot;lat0-sun16&quot;</pre><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;">
        退出重新登录即可</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;"><strong>测试方法:</strong>在终端输入 date 命令测试,如果显示为以下形式,则说明成功解决了<br/></p><pre class="brush:bash;toolbar:false">#date
2009&nbsp;年&nbsp;11&nbsp;月&nbsp;24&nbsp;日&nbsp;星期一&nbsp;12:09:00&nbsp;CST</pre><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;"><strong>如果系统中没有中文字体</strong>,请安装中文字体:<br/></p><pre class="brush:bash;toolbar:false">#yum&nbsp;install&nbsp;fonts-chinese.noarch</pre><p><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">如果字体文件找不到,也可以用rpm包安装</span></p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;">
        &nbsp;</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;">
        需要两个中文支持的包:<br/>
        fonts-chinese-3.02-12.el5.noarch.rpm<br/>
        ftp://ftp.muug.mb.ca/mirror/centos/5.4/os/x86_64/CentOS/fonts-chinese-3.02-12.el5.noarch.rpm</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;">
        fonts-ISO8859-2-75dpi-1.0-17.1.noarch.rpm<br/>
        ftp://ftp.muug.mb.ca/mirror/centos/5.4/os/x86_64/CentOS/fonts-ISO8859-2-75dpi-1.0-17.1.noarch.rpm<br/>
        一 个是中文字体,一个是字体显示包。</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;">
        下载后,在命令行安装:<br/></p><pre class="brush:bash;toolbar:false">#rpm&nbsp;-ivh&nbsp;XXXX&nbsp;(&nbsp;XXXX&nbsp;代表上面那两个包的全名,&nbsp;rpm&nbsp;不会不知道怎么用吧?)</pre><p><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">CentOS系统安装完成后,重新启动即可。</span></p>
頁: [1]
查看完整版本: CentOS终端命令行显示中文乱码的解决方法