Virtual machine visualization tool CentOS garbled characters

Problem discovery
When verifying whether the firewall is closed, it is found that there are garbled characters in the prompt information, as shown in the following figure:
insert image description here

Looking back at the previous system configuration process, it is speculated that the garbled characters were caused by Chinese problems.

Review of the installation process
When installing the CentOS system on a virtual machine, echo LANG="zh_CN.gbk" > /etc/sysconfig/i18inthe command was used to change the language to Chinese. However, after restarting, it was found that the graphical interface of the system was empty. After restarting again, the language selection bar at the bottom of the user login interface (as shown in the figure below) was changed to English, and some prompt information appeared garbled (at that time, there were only the above two in the language bar. , the last Chinese (China) is the option after the modification is successful).
insert image description here

Problem Solving
If GBK encoding fails, use UTF-8 encoding to solve the problem of garbled characters.
First use localethe command to check whether there is a corresponding Chinese language pack
insert image description here

If the above appears, it means that there is, if not, you need to use yum groupinstall chinese-supportthe command to install, and the installation process must be connected to the Internet, otherwise the installation will fail.

After the installation is complete, use LANG="zh_CN.UTF-8"the modified language, and then enter vi /etc/sysconfig/i18nthe modified configuration file, the modified content is still LANG="zh_CN.UTF-8". The file can then cat /etc/sysconfig/i18nbe viewed with the command i18in. It is correct as shown in the figure below.
insert image description here

Finally, don't forget to rebootcommand to restart the virtual machine to make the configuration take effect.

Enter echo $LANGthe command to view the current language, and finally appear
insert image description here

Then the language change is successful.

Guess you like

Origin blog.csdn.net/qq_54042324/article/details/121661250