1. Check whether the Chinese package is installed
You can use the following name to check whether the Chinese installation package is installed in the system.
locale -a |grep "zh_CN" Copy code

If there is no output, it means there is no installation. Enter the following command to install:
yum groupinstall "fonts" -y Copy code
After installation, check which Chinese language packs are installed
[root@iz2ze6adlpez0gy7j13vrmz /]# locale -a | grep "zh_CN" zh_CN zh_CN.gb18030 zh_CN.gb2312 zh_CN.gbk zh_CN.utf8 Copy code
It indicates that the Chinese language pack has been installed in the system and does not need to be installed again. Important note: if your system still cannot use Chinese according to the following steps, please try the above coding method one by one. For example, change LANG="zh_CN" to LANG="zh_CN.gb18030".
2. Modify the configuration file
Before modifying the configuration file, let's take a look at the current system locale:
# echo $LANG en_US.UTF-8 # locale LANG=en_US.UTF-8 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= Copy code
Although the Chinese language pack is installed, the local language environment is not Chinese, and the locale.conf configuration file needs to be modified
# vim /etc/locale.conf LANG="zh_CN" # source /etc/locale.conf vim /etc/locale.conf Enter the edit page and enter i Start editing and finish entering esc Bottom line mode, then enter: wq,Save and exit Copy code

You can also modify the locale.conf configuration file using the command:
# localectl set-locale LANG=zh_CN Copy code
Then view the current locale:
# echo $LANG zh_CN # locale LANG=zh_CN LC_CTYPE="zh_CN" LC_NUMERIC="zh_CN" LC_TIME="zh_CN" LC_COLLATE="zh_CN" LC_MONETARY="zh_CN" LC_MESSAGES="zh_CN" LC_PAPER="zh_CN" LC_NAME="zh_CN" LC_ADDRESS="zh_CN" LC_TELEPHONE="zh_CN" LC_MEASUREMENT="zh_CN" LC_IDENTIFICATION="zh_CN" LC_ALL= Copy code
3. Whether the verification is successful
[root@node2 ~]# date 2017 Monday, 16 October:30:24 CST Copy code
4. Supplementary interpretation of the order
locale -a |grep "zh_CN": list the names of all available common locales, and then filter Chinese
locale -a: lists the names of all available common locales
If you can see the following items, it also indicates that the Chinese language pack has been installed in the system. No more installation is required. What do these items mean?

{language code}_ {country code}. {character set}
zh is the Chinese code, CN is the Chinese code, gb18030,gb2312,utf8 is the language character set
Then each item can be popularly understood as "you speak Chinese, you are in China, and the language character set is gb18030/gb2312/utf8"
If the above items are not found, install the Chinese language pack manually
#yum install kde-l10n-Chinese (about 11M)
Locale: view the current system locale

("en_US.UTF-8" can be understood as "you speak English, you are in the United States, and the language character set is UTF-8")
Each item means:
LANG: language of the current system
LC_CTYPE: language symbols and their classification
LC_NUMERIC: numeric
LC_COLLATE: compare and sort habits
LC_TIME: time display format
LC_MONETARY: monetary unit
LC_MESSAGES: information mainly includes prompt information, error information, status information, title, label, button, menu, etc
LC_NAME: name writing method
LC_ADDRESS: address writing method
LC_TELEPHONE: telephone number writing method
LC_ Measure: measure expression
LC_PAPER: default paper size
LC_IDENTIFICATION: an overview of the information contained in the locale itself
LC_ALL: variable with the highest priority. If this variable is set, all LC_* And LANG variables are forced to follow its value
We can see that although the Chinese language pack is installed, the local language environment is not Chinese
Restart the system
# reboot Copy code
5. Solution of garbled code in remote tool SSH Secure
When using remote tools to connect, if linux has Chinese files or directories, garbled codes will appear when displaying. Why Yes, the linux code is UTF-8, while the remote tool defaults to the current system local code, that is, GBK. So the solution is system One or two codes are OK, but the SSH Secure tool cannot set the code, so modify the linux system Unified coding.
Step 1: view the locale of the current system.
This is because it has been modified to gbk code.

Step 2: modify the configuration file locale.conf
# vim /etc/locale.conf Copy code
Enter i to enter the editing mode. After editing, press ESC to enter the bottom line mode. Then enter: wq exit and save.
Execute the following command to make the modification effective.
# source /etc/locale.conf Copy code
Enter date validation. If you still have problems, you can reboot.
