在第一次登录系统会出现报错:perl: warning: Setting locale failed.
root@linyk3:~# adduser linyk3
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_PAPER = "zh_CN.UTF-8",
LC_ADDRESS = "zh_CN.UTF-8",
LC_MONETARY = "zh_CN.UTF-8",
LC_NUMERIC = "zh_CN.UTF-8",
LC_TELEPHONE = "zh_CN.UTF-8",
LC_IDENTIFICATION = "zh_CN.UTF-8",
LC_MEASUREMENT = "zh_CN.UTF-8",
LC_TIME = "zh_CN.UTF-8",
LC_NAME = "zh_CN.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
root@linyk3:~#
经过网上查询perl: warning: Setting locale failed.引发的问题
那是因为安装软件时,都会去执行一个update-locale的命令,用来更新locale
这个命令是一个脚本,用perl写的,可以用whereis update-locale查到,位置在/usr/sbin/update-locale
其实,真正的原因是perl为系统使用zh_CN.UTF-8,但系统不知道zh_CN.UTF-8是什么东西
所以安装一个中文语言,系统就知道zh_CN.UTF-8了,这个时候用perl就不会报错了
apt-get install language-pack-zh-hans
但是在执行过程中报错:
root@linyk3:~# apt-get install language-pack-zh-hans
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package language-pack-zh-hans
root@linyk3:~# apt-get install language-pack-zh-hans
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package language-pack-zh-hans
root@linyk3:~#
应该是没有更新,所以执行下:
apt-get update
更新结束后再安装中文包就可以了。
root@linyk3:~# apt-get install language-pack-zh-hans
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-4.4.0-87 linux-headers-4.4.0-87-generic linux-image-4.4.0-87-generic linux-image-extra-4.4.0-87-generic
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
language-pack-zh-hans-base
The following NEW packages will be installed:
language-pack-zh-hans language-pack-zh-hans-base
0 upgraded, 2 newly installed, 0 to remove and 162 not upgraded.
Need to get 2110 kB of archives.
After this operation, 8545 kB of additional disk space will be used.
Do you want to continue? [Y/n]
网友评论