如何为Ubuntu添加中文支持

我的寝室电脑装了VMWare虚拟机,虚拟机里装了Ubuntu8.04,虚拟机与外界无法联网。

近些天来突发奇想,想试一下纯Linux下工作感觉如何,但发现初装系统时默认的是用英语安装,系统不支持中文输入,也不持其显示,好生郁闷,纠结了好几天,终于想到一个办法,解决之。

纵然我无法联网,要想装中文语言包,还是要那些安装文件的,那些文件哪里去找呢?嘿嘿,简单,我们可以依次打开system->Adminstration->Language Support打开,打开后将chinese选中,应用,我们会看到Ubuntu列出了个详细清单,清单上列明了有哪些软件要更新,有哪些软件要安装,注意,光知道软件名还是不行的,其版本号也是相当关键的,要求一个数字也不能错的,下面是我的Ubuntu需要更新及添加的软件清单,如下:

libpango1.0-0 (version 1.20.1-1) will be upgraded to version 1.20.5-0ubuntu1.1
 libpango1.0-common (version 1.20.1-1) will be upgraded to version 1.20.5-0ubuntu1.1
 language-pack-gnome-zh (version 1:8.04+20100117) will be installed
 language-pack-gnome-zh-base (version 1:8.04+20100117) will be installed
 language-pack-zh (version 1:8.04+20100117) will be installed+
 language-pack-zh-base (version 1:8.04+20100117) will be installed
 language-support-fonts-zh (version 1:8.04+20080229) will be installed
 language-support-input-zh (version 8.04+20080214) will be installed
 language-support-translations-zh (version 1:8.04+20080407) will be installed
 language-support-zh (version 1:8.04+20080214) will be installed
 libchewing3 (version 0.3.0-1) will be installed
 libchewing3-data (version 0.3.0-1) will be installed
 openoffice.org-help-zh-cn (version 1:2.4.1-1ubuntu2.1) will be installed
 openoffice.org-help-zh-tw (version 1:2.4.1-1ubuntu2.1) will be installed
 openoffice.org-l10n-zh-cn (version 1:2.4.1-1ubuntu2.1) will be installed
 openoffice.org-l10n-zh-tw (version 1:2.4.1-1ubuntu2.1) will be installed
 scim-chewing (version 0.3.1-2ubuntu3) will be installed
 +scim-modules-table (version 0.5.7-2ubuntu1) will be installed
 scim-tables-zh (version 0.5.7-2ubuntu1) will be installed
 +thunderbird (version 2.0.0.24+build1+nobinonly-0ubuntu0.8.04.1) will be installed
 thunderbird-locale-zh-cn (version 1:2.0.0.14+1-0ubuntu1~8.04.1) will be installed
 thunderbird-locale-zh-tw (version 1:2.0.0.14+1-0ubuntu1~8.04.1) will be installed
 xfonts-wqy (version 0.9.9-3) will be installed

 有了这些清单,我们便可以去Ubuntu官方网站上下载对应的软件,一个个下载确实繁琐,可谁叫咱命苦呢,硬 着头皮一点点的下吧,其下是及对应的下载地址:

 http://mirrors.kernel.org/ubuntu/pool/main/o/openoffice.org-l10n/openoffice.org-l10n-zh-tw_2.4.1-1ubuntu2.1_all.deb http://security.ubuntu.com/ubuntu/pool/main/t/thunderbird/thunderbird_2.0.0.24+build1+nobinonly-0ubuntu0.8.04.1_i386.deb
 http://mirrors.kernel.org/ubuntu/pool/main/s/scim-tables/scim-modules-table_0.5.7-2ubuntu1_i386.deb
 http://mirrors.kernel.org/ubuntu/pool/main/t/thunderbird-locales/thunderbird-locale-zh-tw_2.0.0.14+1-0ubuntu1~8.04.1_all.deb
 http://mirrors.kernel.org/ubuntu/pool/main/t/thunderbird-locales/thunderbird-locale-zh-cn_2.0.0.14+1-0ubuntu1~8.04.1_all.deb
 http://mirrors.kernel.org/ubuntu/pool/main/s/scim-tables/scim-tables-zh_0.5.7-2ubuntu1_all.deb
 http://mirrors.kernel.org/ubuntu/pool/main/s/scim-chewing/scim-chewing_0.3.1-2ubuntu3_i386.deb
 http://security.ubuntu.com/ubuntu/pool/main/o/openoffice.org-l10n/openoffice.org-l10n-zh-cn_2.4.1-1ubuntu2.1_all.deb
 http://mirrors.kernel.org/ubuntu/pool/main/o/openoffice.org-l10n/openoffice.org-help-zh-tw_2.4.1-1ubuntu2.1_all.deb
 http://security.ubuntu.com/ubuntu/pool/main/o/openoffice.org-l10n/openoffice.org-help-zh-cn_2.4.1-1ubuntu2.1_all.deb
 http://mirrors.kernel.org/ubuntu/pool/main/libc/libchewing/libchewing3-data_0.3.0-1_i386.deb
 http://mirrors.kernel.org/ubuntu/pool/main/libc/libchewing/libchewing3_0.3.0-1_i386.deb
 http://mirrors.kernel.org/ubuntu/pool/main/l/language-support-zh/language-support-zh_8.04+20080214_all.deb
 http://mirrors.kernel.org/ubuntu/pool/main/l/language-support-translations-zh/language-support-translations-zh_8.04+20080407_all.deb
 http://mirrors.kernel.org/ubuntu/pool/main/l/language-support-input-zh/language-support-input-zh_8.04+20080214_all.deb
 http://mirrors.kernel.org/ubuntu/pool/main/x/xfonts-wqy/xfonts-wqy_0.9.9-3_all.deb
 http://mirrors.kernel.org/ubuntu/pool/main/l/language-support-fonts-zh/language-support-fonts-zh_8.04+20080229_all.deb
 http://mirrors.kernel.org/ubuntu/pool/main/l/language-pack-zh/language-pack-zh_8.04+20100117_all.deb
 http://mirrors.kernel.org/ubuntu/pool/main/l/language-pack-zh-base/language-pack-zh-base_8.04+20100117_all.deb
 http://mirrors.kernel.org/ubuntu/pool/main/l/language-pack-gnome-zh/language-pack-gnome-zh_8.04+20100117_all.deb
 http://mirrors.kernel.org/ubuntu/pool/main/l/language-pack-gnome-zh-base/language-pack-gnome-zh-base_8.04+20100117_all.deb
 http://security.ubuntu.com/ubuntu/pool/main/p/pango1.0/libpango1.0-common_1.20.5-0ubuntu1.1_all.deb
 http://security.ubuntu.com/ubuntu/pool/main/p/pango1.0/libpango1.0-0_1.20.5-0ubuntu1.1_i386.deb

 软件名都在下载链接里,我就不单独提取了。

 将下载后的文件压缩到一个tar文件里(我用的是TC软件),而后放到我主机架设的ftp服务器中,二进制模式下下载到Ubuntu中,解压到一个目录,譬如是last.

 而后一个命令搞定 ,sudo dpkg *.deb

 注销后重新登录, 结果发现Alt+F2, 打开gedit编辑程序,右键选择Input Methods->SCIM Input Method, 然后切换输入法,Oh Yeah!可以输入中文了,然而。。。

 然而我打开Firefox,想输入个汉字,可发现令我失望了,无法输入中文,还是一如继往的中文。继续在网络上蜘蛛似的搜索,搜索,发现是我的Locale设置的问题,我的Locale只有简单的两行,全是采用的英文,难怪不行呢,下面要开始改Locale。

 首先,将系统支持的locale都拷贝过来到自己的配置文件中:

 cp /usr/share/i18n/SUPPORTED /var/lib/locales/supported.d/local

 然后,重新生成locale支持文件

 locale-gen --purge

 最后,就是配置环境了

 more /etc/default/locale
 LC_CTYPE=en_US.UTF-8
 LC_NUMERIC=en_US.UTF-8
 LC_TIME=en_US.UTF-8
 LC_COLLATE=zh_CN.UTF-8
 LC_MONETARY=en_US.UTF-8
 LC_MESSAGES=en_US.UTF-8
 LC_PAPER=en_US.UTF-8
 LC_NAME=en_US.UTF-8
 LC_ADDRESS=en_US.UTF-8
 LC_TELEPHONE=en_US.UTF-8
 LC_MEASUREMENT=en_US.UTF-8
 LC_IDENTIFICATION=en_US.UTF-8
 LC_ALL=
 LANGUAGE=en_US:en
 GST_ID3_TAG_ENCODING=GBK
 LANG=en_US.UTF-8
 可以设的值也就是在/var/lib/locales/supported.d/local中
 说明一下,各个值都是啥用:
 语言符号及其分类 (LC_CTYPE)
 数字 (LC_NUMERIC)
 比较和排序习惯 (LC_COLLATE)
 时间显示格式 (LC_TIME)
 货币单位 (LC_MONETARY)
 信息主要是提示信息,错误信息, 状态信息, 标题, 标签, 按钮和菜单等(LC_MESSAGES)
 姓名书写方式 (LC_NAME)
 地址书写方式 (LC_ADDRESS)
 电话号码书写方式 (LC_TELEPHONE)
 度量衡表达方式 (LC_MEASUREMENT)
 默认纸张尺寸大小 (LC_PAPER)
 locale自身包含信息的概述 (LC_IDENTIFICATION)



因为我们是要对中文进行支持,显然将LC_CTYPE改为zh_CN-UTF-8就可以了

注销,重新登陆,检查下,可以输入中文了吧?