更改linux centos 7系统语言

  1. 查看当前系统语言
    #locale
  2. 查看当前系统支持的语言中是否有要用的语言,如以中文为例
    #locale -a | grep zh_CN
  3. 更改系统语言,修改 locale.conf文件
    #vi /etc/locale.conf
    将内容改为:LANG="zh_CN.UTF-8"
  4. 更新配置文件
    #source /etc/locale.conf
  • 查看结果 locale

    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


    如查找时出现以下异常,可按以下方式解决
    异常:
    -----------------------------------------------------------------------
    # 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"
    ----------------------------------------------------------------------------------
     
  •  如果要设置中文版的字体编码。在每个文件中增加以下内容
# vim /etc/profile.d/locale.sh
export LC_CTYPE=zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8

# vim /etc/locale.conf
LANG=zh_CN.UTF-8

# vim /etc/sysconfig/i18n
LANG=zh_CN.UTF-8

# vim /etc/environment
LANG=zh_CN.UTF-8
LC_ALL=zh_CN.UTF-8

# source /etc/profile.d/locale.sh
# source /etc/locale.conf
# source /etc/sysconfig/i18n
# source /etc/environment
  • 如果要设置英文版的字体编码。在每个文件中增加以下内容
    # vim /etc/profile.d/locale.sh
    export LC_CTYPE=en_US.UTF-8
    export LC_ALL=en_US.UTF-8
    
    # vim /etc/locale.conf
    LANG=en_US.UTF-8
    
    # vim /etc/sysconfig/i18n
    LANG=en_US.UTF-8
    
    # vim /etc/environment
    LANG=en_US.UTF-8
    LC_ALL=en_US.UTF-8
    
    # source /etc/profile.d/locale.sh
    # source /etc/locale.conf
    # source /etc/sysconfig/i18n
    # source /etc/environment
    

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值