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:
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/i18in
the 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).
Problem Solving
If GBK encoding fails, use UTF-8 encoding to solve the problem of garbled characters.
First use locale
the command to check whether there is a corresponding Chinese language pack
If the above appears, it means that there is, if not, you need to use yum groupinstall chinese-support
the 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/i18n
the modified configuration file, the modified content is still LANG="zh_CN.UTF-8"
. The file can then cat /etc/sysconfig/i18n
be viewed with the command i18in
. It is correct as shown in the figure below.
Finally, don't forget to reboot
command to restart the virtual machine to make the configuration take effect.
Enter echo $LANG
the command to view the current language, and finally appear
Then the language change is successful.