1. 查看当前语言
    locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
  1. 查看当前已安装的语言
    locale -a
C
C.UTF-8
POSIX
  1. 安装语言包
    apt-get install language-pack-zh-hans
    locale-gen zh_CN.UTF-8
    再次查看
    locale -a
C
C.UTF-8
POSIX
zh_CN.utf8
zh_SG.utf8
  1. 添加到文件
    echo "export LC_ALL=zh_CN.UTF-8">> /etc/profile
    source /etc/profile
    如果这里添加失败,提示没有这种语言包,退出容器,再重新进入,就可以添加了
  2. 完成
    locale
LANG=
LANGUAGE=
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
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐