Ubuntu/debian 设置中文 locales

Linux 2013-07-23

Ubuntu 设置方法:

nano /etc/default/locale

添加一行

LANG="zh_CN.UTF-8"
/usr/share/locales/install-language-pack zh_CN
locales-gen

在某些服务器上可以用下面的方法来设置:

nano /var/lib/locales/supported.d/en

保留en_US.UTF-8 UTF-8就可以,其他删掉。

nano /var/lib/locales/supported.d/local

添加zh_CN.UTF-8 UTF-8

最后运行

dpkg-reconfigure locales

就可以了。

Debian 设置方法:

cat >/etc/locale.gen<<eof
en_US.UTF-8 UTF-8
zh_CN.GBK GBK
zh_CN.UTF-8 UTF-8
eof

/usr/sbin/locale-gen

cat >/etc/default/locale<<eof
LANG=zh_CN.UTF-8
eof

或者手动设置,第二种方法:

dpkg-reconfigure lcoales

选中zh_CN.UTF-8确定即可。