一般unbuntu里面没有安装中文包,所以第一步先进行换源,然后在下载 中文包会比较快
第一步,换源
Ubuntu 18.04换国内源
编辑/etc/apt/sources.list
文件, 在文件最前面添加以下条目(操作前请做好相应备份):
阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
然后执行命令:
sudo apt-get update
sudo apt-get upgrade
更新好了之后
第二步:安装中文包
sudo apt-get install language-pack-zh-han*
安装好了之后重启服务器
reboot unbuntu
在运行代码进行 修改文件
这样启动终端的时候就是选UTF-8的编码了,然后设置/etc/environment
sudo vi /etc/environment
然后在PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"下面添加
LANGUAGE="zh_CN:zh:en_US:en"
LC_ALL=zh_CN.UTF-8
LANG=zh_CN
然后去Putty里面进行设置
然后再
然后open 就可以了
如图所示