博采众长,精于一技。Live for love, work for dream.

Ubuntu下设置中文locale

一般VPS刚开通不没有装中文的locale,通常会报这样的错误。
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "zh_CN.utf8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
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

这个要自己去设定。

1.查看当前系统语言环境
locale

2.查看系统内安装的locale
root@ubuntu-vps:~# locale -a
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
C
POSIX

3.安装zh_CN.utf8
root@ubuntu-vps:~# cd /usr/share/locales
root@ubuntu-vps:/usr/share/locales# ls
install-language-pack  remove-language-pack
root@ubuntu-vps:/usr/share/locales# ./install-language-pack zh_CN
Generating locales...
  zh_CN.UTF-8... done
Generation complete.
dpkg-trigger: dpkg-trigger 必须从维护者脚本中调用(或者通过 --by-package 选项)

4.验证locale安装是否成功
root@ubuntu-vps:/usr/share/locales# locale
LANG=zh_CN.utf8
LC_CTYPE="zh_CN.utf8"
LC_NUMERIC="zh_CN.utf8"
LC_TIME="zh_CN.utf8"
LC_COLLATE="zh_CN.utf8"
LC_MONETARY="zh_CN.utf8"
LC_MESSAGES="zh_CN.utf8"
LC_PAPER="zh_CN.utf8"
LC_NAME="zh_CN.utf8"
LC_ADDRESS="zh_CN.utf8"
LC_TELEPHONE="zh_CN.utf8"
LC_MEASUREMENT="zh_CN.utf8"
LC_IDENTIFICATION="zh_CN.utf8"
LC_ALL=

日志信息 »

该日志于2011-01-18 11:15由 Rebill 发表在运维管理分类下, 你可以发表评论。除了可以将这个日志以保留源地址及作者的情况下引用到你的网站或博客,还可以通过评论 RSS订阅这个日志的所有评论。

相关日志 »

赞助链接 »

已有 2 条评论 »

  1. [...]Ubuntu下设置中文locale[...]

  2. Tlexander Tlexander

    dpkg-trigger: dpkg-trigger 必须从维护者脚本中调用(或者通过 --by-package 选项)

    什么意思,怎么用?

添加新评论 »

返回顶部
无觅相关文章插件,快速提升流量