(1) 更新軟件包列表 apt-get update
(2)安裝locales包,apt-get install -y locales。安裝完成后會自動生產/etc/locale.gen
(3) 去掉/etc/locale.gen文件中zh_CN.UTF-8所在行前面的注釋,sed -i 's/^# *\(zh_CN.UTF-8\)/\1/' /etc/locale.gen
(4) 運行locale-gen命令
(5) 在~/.bashrc中設置LC_ALL、LANG、LANGUAGE
echo "export LC_ALL=zh_CN.UTF-8" >> ~/.bashrc \
echo "export LANG=zh_CN.UTF-8" >> ~/.bashrc \
echo "export LANGUAGE=zh_CN.UTF-8" >> ~/.bashrc
(6) source ~/.bashrc
