search
HomeOperation and MaintenanceCentOSHow to solve the problem of Chinese garbled characters in centos5.5

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"

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"

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"

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"

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

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

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/

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

cp /etc/X11/xorg.conf /etc/X11/xorg.conf.back
vim /etc/X11/xorg.conf

4. Find the FontPath section and add:

FontPath “/usr/share/fonts/wenquanyi/wqy-zenhei”

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

6. Add before :

<dir>/usr/share/fonts/wenquanyi/wqy-zenhei/</dir>

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

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

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

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

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

然后在/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

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

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

三、卸载方法

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

 

功能介绍

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

重启动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
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
CentOS: Exploring the AlternativesCentOS: Exploring the AlternativesApr 15, 2025 am 12:03 AM

Alternatives to CentOS include UbuntuServer, Debian, Fedora, RockyLinux, and AlmaLinux. 1) UbuntuServer is suitable for basic operations, such as updating software packages and configuring the network. 2) Debian is suitable for advanced usage, such as using LXC to manage containers. 3) RockyLinux can optimize performance by adjusting kernel parameters.

Centos shutdown command lineCentos shutdown command lineApr 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.

Difference between centos and ubuntuDifference between centos and ubuntuApr 14, 2025 pm 09:09 PM

The key differences between CentOS and Ubuntu are: origin (CentOS originates from Red Hat, for enterprises; Ubuntu originates from Debian, for individuals), package management (CentOS uses yum, focusing on stability; Ubuntu uses apt, for high update frequency), support cycle (CentOS provides 10 years of support, Ubuntu provides 5 years of LTS support), community support (CentOS focuses on stability, Ubuntu provides a wide range of tutorials and documents), uses (CentOS is biased towards servers, Ubuntu is suitable for servers and desktops), other differences include installation simplicity (CentOS is thin)

Centos configuration IP addressCentos configuration IP addressApr 14, 2025 pm 09:06 PM

Steps to configure IP address in CentOS: View the current network configuration: ip addr Edit the network configuration file: sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0 Change IP address: Edit IPADDR= Line changes the subnet mask and gateway (optional): Edit NETMASK= and GATEWAY= Lines Restart the network service: sudo systemctl restart network verification IP address: ip addr

How to install centosHow to install centosApr 14, 2025 pm 09:03 PM

CentOS installation steps: Download the ISO image and burn bootable media; boot and select the installation source; select the language and keyboard layout; configure the network; partition the hard disk; set the system clock; create the root user; select the software package; start the installation; restart and boot from the hard disk after the installation is completed.

Centos8 restarts sshCentos8 restarts sshApr 14, 2025 pm 09:00 PM

The command to restart the SSH service is: systemctl restart sshd. Detailed steps: 1. Access the terminal and connect to the server; 2. Enter the command: systemctl restart sshd; 3. Verify the service status: systemctl status sshd.

How to restart the network in centos8How to restart the network in centos8Apr 14, 2025 pm 08:57 PM

Restarting the network in CentOS 8 requires the following steps: Stop the network service (NetworkManager) and reload the network module (r8169), start the network service (NetworkManager) and check the network status (by ping 8.8.8.8)

Restart centos7 commandRestart centos7 commandApr 14, 2025 pm 08:54 PM

Reboot command is available to restart CentOS 7. The steps are as follows: Open the terminal window and enter the reboot command. Confirm the restart prompt. The system will restart and the boot menu will appear during this period. After the restart is complete, log in with the credentials.

See all articles

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment