第一步:查看自己系统的字符集
先查看系统的默认字符集格式:locale 或者cat /etc/default/locale
root@JumpServer-APP-T02:~# locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.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=
root@JumpServer-APP-T02:~#
测试
root@JumpServer-APP-T01:~# date
Mon 06 Mar 2023 11:21:23 AM UTC
root@JumpServer-APP-T01:~#
第二步:安装中文语言字符
输入命令:sudo apt install language-pack-zh-han* -y
sudo apt install language-pack-zh-han* -y
第三步:备份原始配置文件
查看配置文件中是否有locale和locale.bak两个文件
root@JumpServer-APP-T01:~# cp /etc/default/locale /etc/default/locale.bak
root@JumpServer-APP-T01:~# ls /etc/default
amd64-microcode console-setup cryptdisks grub.d irqbalance locale.bak networkd-dispatcher pollinate ufw
apport crda dbus grub.ucf-dist keyboard mdadm nss rsync useradd
bsdmainutils cron grub intel-microcode locale motd-news open-iscsi ssh
root@JumpServer-APP-T01:~#
第四步:编辑配置文件
查看原始的配置文件
root@JumpServer-APP-T01:~# cat /etc/default/locale
LANG=en_US.UTF-8
配置新的配置文件内容,并查看
root@JumpServer-APP-T01:~# vim /etc/default/locale
root@JumpServer-APP-T01:~# cat /etc/default/locale
LANG=zh_CN.UTF-8
root@JumpServer-APP-T01:~#
第五步:重新启动电脑生效
输入命令:reboot
root@JumpServer-APP-T01:~# reboot
Connection closing...Socket close.
Connection closed by foreign host.
Disconnected from remote host(JumpServer-1) at 19:20:43.
Type `help' to learn how to use Xshell prompt.
[C:\~]$
第六步:配置文件立即生效
输入命令:source /etc/default/locale
root@JumpServer-APP-T01:~# source /etc/default/locale
第七步:测试成功
root@JumpServer-APP-T01:~# date
2023年 03月 06日 星期一 11:20:03 UTC
root@JumpServer-APP-T01:~#
标签:中文,en,UTF,locale,APP,字符集,JumpServer,ubuntu,root From: https://www.cnblogs.com/Magiclala/p/17185082.html