Home Operation and Maintenance CentOS How to solve the problem of Chinese garbled characters in centos5.5

How to solve the problem of Chinese garbled characters in centos5.5

Jan 11, 2022 pm 02:44 PM

Solution to Chinese garbled characters in centos5.5: 1. Modify the "/etc/sysconfig/i18n" file; 2. Add "export LC_ALL="zh_CN.GB18030"" to the "/etc/profile" file ;3. Install font files.

How to solve the problem of Chinese garbled characters in centos5.5

The operating environment of this article: centos5.5 system, Dell G3 computer.

How to solve the problem of Chinese garbled characters in centos5.5?

CentOS 5.5 Chinese garbled problem solution

When you create a new CentOS host in VMware7.1, add CentOS 5.5 bin-DVD disc installation directly and you will be prompted to enter the user Password information, if installed in this way, CentoOS system configuration will be skipped directly. This may be an integrated function of the new version of VMware, but once skipped, there is no configuration to support the Chinese language. It will bring trouble to the subsequent Chinese translation work. But there is still a solution, as follows:

After installation. Full English interface, the only online search solution is:

Modify /etc/sysconfig/i18n file

 #LANG="en_US.UTF-8"
 
 #SUPPORTED="en_US.UTF-8:en_US:en"
 
 #SYSFONT="latarcyrheb-sun16"
Copy after login

is changed to

1 LANG="zh_CN.GB18030"
 
2 LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
 
3 SUPPORTED="zh_CN.GB18030:zh_CN:zh"
 
4 SYSFONT="lat0-sun16" SYSFONTACM="8859-15"
Copy after login

In this way, Chinese can generally work normally in SSH and telnet terminals shown.

If it still doesn’t work, you can do this:

1. Console terminal garbled code

Add the following content to the last line of the /etc/profile file:

export LC_ALL="zh_CN.GB18030"
Copy after login
Copy after login

2. xwindow terminal garbled code

Add the following content to the last line of the /etc/sysconfig/i18n file :

export LC_ALL="zh_CN.GB18030"
Copy after login
Copy after login

First of all, modify it. They are all garbled codes in square boxes, and the Chinese version cannot be used. It doesn't work after reboot either. Although most people say that it takes effect immediately without restarting.

Then I think it may be because there is no font,

 yum install fonts-chinese.noarch
 
 yum install fonts-ISO8859-2.noarch
Copy after login

How can I still display the method? Frame Chinese characters. Next I want to start by modifying the font.

Download Wenquanyi’s Zhenghei font installation,

1. Unzip the compressed package of the font file:

su -
tar zxvf wqy-zenhei*.tar.gz
Copy after login

2. Place the unzipped folder “wqy-zenhei” Move to the /usr/share/fonts/wenquanyi/ directory:

mv wqy-zenhei /usr/share/fonts/wenquanyi/
*如果/usr/share/fonts/wenquanyi/不存在,请先建立:
mkdir -p /usr/share/fonts/wenquanyi/
Copy after login

3. Edit the /etc/X11/xorg.conf file:

cp /etc/X11/xorg.conf /etc/X11/xorg.conf.back
vim /etc/X11/xorg.conf
Copy after login

4. Find the FontPath section and add:

FontPath “/usr/share/fonts/wenquanyi/wqy-zenhei”
Copy after login

Save the file.

5. If your system has the /etc/fonts/fonts.conf file, please edit it:

cp  /etc/fonts/fonts.conf /etc/fonts/fonts.conf.back
vim /etc/fonts/fonts.conf
Copy after login

6. Add before :

<dir>/usr/share/fonts/wenquanyi/wqy-zenhei/</dir>
Copy after login

save document.

7. If your system uses fontconfig 2.4.x, move the 44-wqy-zenhei.conf file under /usr/share/fonts/wenquanyi/wqy-zenhei/ to ~/.font. conf

Restart the X server and select the Chinese font. Chinese is finally displayed, but it is a bit ugly. It would be good to modify the theme and make some fine adjustments.

Next, install the zend server ce for linux version. Because I have modified the domestic source, installation with a script may be very slow. Directly download the installation package, decompress it and install successfully. After restarting, an error message appears: cannot restore segment prot after reloc:permission denied.

1How to turn off SELINUX:

vi /etc/selinux/config Change SELINUX=enforcing to SELINUX=disabled. Restart is required

This method may bring risks to the server.

2 Method of not closing SELINUX:

# setenforce 0
# chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t /usr/local/apache/modules/libPHP5.so
# service httpd restart
# setenforce 1
Copy after login

Finally solved, but without Wubi, isn’t this fatal? To solve this problem, install fcitx through comprehensive comparison:

Under CentOS 5.5, use the source code package to install Fcitx. The latest version of Little Penguin Input Method: fcitx-3.6.3-rc.tar.bz2

First of all, declare 2 points:

1. All operations in this article are performed under the terminal. Unless otherwise stated, the commands in this article are all entered under the "Terminal".

2. Because CentOS is completely based on Redhat enterprise linux (RHEL), the method of installing Fcitx in this article is completely 100% applicable to RHEL.

1. Solve the dependency problem of Fcitx in advance

Fcitx depends on: gettext, gettext-devel, libXft, libXft-devel, libXpm and libXpm-devel, this Six software packages.

You can use yum install package name to install them separately in advance to solve dependency problems.

yum install gettext gettext-devel libXft libXft-devel libXpm libXpm-devel automake autoconf libXtst-devel 
gtk+-devel gcc zlib-devel libpng-devel gtk2-devel glib-devel
yum install gettext-devel
yum install libXft-devel
yum install libXpm-devel
yum install automake
 
yum install libXtst-devel
Copy after login

2. Compile and install

1. Download the source code package of the latest version of Fcitx: wget http://fcitx.googlecode.com/files/fcitx-3.6 .3.tar.bz2

2. Unzip to "/usr/src": tar -jxvf fcitx-3.6.3.tar.bz2 -C /usr/src

3 . Enter the directory: cd /usr/src/fcitx-3.6.3

4. Generate the ".configure" file: ./autogen.sh

5. Start compiling: ./configure

Note: There will be warning prompts during the compilation process under Centos 5, please ignore it, it will be fine. There will be no warning under RHEL.

6. Formal installation: make && make install

7. Test whether the installation is successful: enter fcitx -h. If the installation is successful, you should be able to get the help file, as follows:

Usage: fcitx [OPTION]
-d        run as daemon(default)
-D        don’t run as daemon
-n[im name]    run as specified name
-v        display the version information and exit
-h        display this help and exit
Copy after login

3. Configure Fcitx as the default input method

Installation method one:

1. Create a new configuration file: vim /etc/X11/xinit/xinput.d/fcitx, the content is :

XIM=fcitx
XIM_PROGRAM=fcitx
GTK_IM_MOUDLE=fcitx
QT_IM_MOUDLE=fcitx
Copy after login

Save and exit, restart the computer

2. 查询Fcitx是否开机运行。终端下输入:fcitx,应该是提示:Start FCITX error. Another XIM daemon named SCIM is running?这样就对了,直接到”4“

3. 如果没任何提示,则:ln -s /etc/X11/xinit/Xinput.d/fcitx /$HOME/.xinputrc

4. 输入: fcitx -nb ,即可看到输入框

默认fcitx启动后,是在后台运行的,因此看不到输入框,用上面的命令就可以调出来了。

ctrl+空格 切换输入法。

安装方法二:

首先在/etc/X11/xinit/xinput.d/目录下建立一个新文件(fcitx.conf):

XIM=fcitx
XIM_PROGRAM=/usr/local/bin/fcitx
XIM_ARGS=”-d”
GTK_IM_MODULE=fcitx
QT_IM_MODULE =fcitx
Copy after login

然后在/etc/alternatives/目录下,将符号链接xinputrc删除,重新建一个:

mv /etc/alternatives/xinputrc /etc/alternatives/xinputrc.save
rm –rf /etc/alternatives/xinputrc
ln -s /etc/X11/xinit/xinput.d/fcitx.conf /etc/alternatives/xinputrc
Copy after login

最后,在开始菜单> 系统> 首选项preferences > 更多首选项more preferences >输入法input method,在里面选择“使用系统范围内的配置[fcitx]”,然后“注销”,登录后按“ctrl+空格”就可激活fcitx输入法。

配置fcitx输入法修改~/.fcitx/config文件中的相应偏好设置。

三、卸载方法

进入目录:cd /usr/src/fcitx-3.6.3
make uninstall
Copy after login

功能介绍

1、常用热键

* 打开/关闭输入法:左ctrl+空格/左ctrl+左shift

* 快速中英文切换:左ctrl

* 切换输入法:alt+1–>五笔 alt+2–>拼音 alt+3–>区位,或用左ctrl+左shift进行循环切换

* 切换全/半角:左shift+空格

* 候选字/词翻页:,./-=

* 重新读入设置:左ctrl+5

还可以安装拼音输入法、在CentOS系统 5.3 中使用中文输入法

命令行输入:

#yum install scim
#yum install scim-pinyin
Copy after login

重启动X(按Ctrl+Alt+Backpace)或注销(logout)。

推荐教程:《centos教程

The above is the detailed content of How to solve the problem of Chinese garbled characters in centos5.5. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What are the methods of tuning performance of Zookeeper on CentOS What are the methods of tuning performance of Zookeeper on CentOS Apr 14, 2025 pm 03:18 PM

Zookeeper performance tuning on CentOS can start from multiple aspects, including hardware configuration, operating system optimization, configuration parameter adjustment, monitoring and maintenance, etc. Here are some specific tuning methods: SSD is recommended for hardware configuration: Since Zookeeper's data is written to disk, it is highly recommended to use SSD to improve I/O performance. Enough memory: Allocate enough memory resources to Zookeeper to avoid frequent disk read and write. Multi-core CPU: Use multi-core CPU to ensure that Zookeeper can process it in parallel.

What are the backup methods for GitLab on CentOS What are the backup methods for GitLab on CentOS Apr 14, 2025 pm 05:33 PM

Backup and Recovery Policy of GitLab under CentOS System In order to ensure data security and recoverability, GitLab on CentOS provides a variety of backup methods. This article will introduce several common backup methods, configuration parameters and recovery processes in detail to help you establish a complete GitLab backup and recovery strategy. 1. Manual backup Use the gitlab-rakegitlab:backup:create command to execute manual backup. This command backs up key information such as GitLab repository, database, users, user groups, keys, and permissions. The default backup file is stored in the /var/opt/gitlab/backups directory. You can modify /etc/gitlab

CentOS Containerization with Docker: Deploying and Managing Applications CentOS Containerization with Docker: Deploying and Managing Applications Apr 03, 2025 am 12:08 AM

Using Docker to containerize, deploy and manage applications on CentOS can be achieved through the following steps: 1. Install Docker, use the yum command to install and start the Docker service. 2. Manage Docker images and containers, obtain images through DockerHub and customize images using Dockerfile. 3. Use DockerCompose to manage multi-container applications and define services through YAML files. 4. Deploy the application, use the dockerpull and dockerrun commands to pull and run the container from DockerHub. 5. Carry out advanced management and deploy complex applications using Docker networks and volumes. Through these steps, you can make full use of D

How to optimize CentOS HDFS configuration How to optimize CentOS HDFS configuration Apr 14, 2025 pm 07:15 PM

Improve HDFS performance on CentOS: A comprehensive optimization guide to optimize HDFS (Hadoop distributed file system) on CentOS requires comprehensive consideration of hardware, system configuration and network settings. This article provides a series of optimization strategies to help you improve HDFS performance. 1. Hardware upgrade and selection resource expansion: Increase the CPU, memory and storage capacity of the server as much as possible. High-performance hardware: adopts high-performance network cards and switches to improve network throughput. 2. System configuration fine-tuning kernel parameter adjustment: Modify /etc/sysctl.conf file to optimize kernel parameters such as TCP connection number, file handle number and memory management. For example, adjust TCP connection status and buffer size

Centos shutdown command line Centos shutdown command line Apr 14, 2025 pm 09:12 PM

The CentOS shutdown command is shutdown, and the syntax is shutdown [Options] Time [Information]. Options include: -h Stop the system immediately; -P Turn off the power after shutdown; -r restart; -t Waiting time. Times can be specified as immediate (now), minutes ( minutes), or a specific time (hh:mm). Added information can be displayed in system messages.

CentOS Backup and Recovery: Ensuring Data Integrity and Availability CentOS Backup and Recovery: Ensuring Data Integrity and Availability Apr 04, 2025 am 12:02 AM

The steps for backup and recovery in CentOS include: 1. Use the tar command to perform basic backup and recovery, such as tar-czvf/backup/home_backup.tar.gz/home backup/home directory; 2. Use rsync for incremental backup and recovery, such as rsync-avz/home//backup/home_backup/ for the first backup. These methods ensure data integrity and availability and are suitable for the needs of different scenarios.

Centos stops maintenance 2024 Centos stops maintenance 2024 Apr 14, 2025 pm 08:39 PM

CentOS will be shut down in 2024 because its upstream distribution, RHEL 8, has been shut down. This shutdown will affect the CentOS 8 system, preventing it from continuing to receive updates. Users should plan for migration, and recommended options include CentOS Stream, AlmaLinux, and Rocky Linux to keep the system safe and stable.

How to configure Lua script execution time in centos redis How to configure Lua script execution time in centos redis Apr 14, 2025 pm 02:12 PM

On CentOS systems, you can limit the execution time of Lua scripts by modifying Redis configuration files or using Redis commands to prevent malicious scripts from consuming too much resources. Method 1: Modify the Redis configuration file and locate the Redis configuration file: The Redis configuration file is usually located in /etc/redis/redis.conf. Edit configuration file: Open the configuration file using a text editor (such as vi or nano): sudovi/etc/redis/redis.conf Set the Lua script execution time limit: Add or modify the following lines in the configuration file to set the maximum execution time of the Lua script (unit: milliseconds)

See all articles