search
HomeOperation and MaintenanceCentOSHow to solve the garbled graphics interface of centos7

How to solve the garbled graphics interface of centos7

How to solve the garbled graphics interface of centos7?

It is found that Chinese garbled characters and Chinese fonts are not neat (overlapping) in the report. The first thing to consider is whether the operating system has Chinese fonts. In CentOS 7, it is found that entering the command to view the font list is a prompt command. Invalid:
How to solve the garbled graphics interface of centos7

As you can see from the picture above, not only are there no Chinese fonts, there are not even font libraries. So next, let’s record how to install the font library and Chinese fonts in Linux CentOS 7.

Installing the font library

In CentOS 4.x, fontconfig is used to install the font library, so enter the following command:

yum -y install fontconfig

When viewing When you get the prompt information in the picture below, it means that the installation has been successful:

How to solve the garbled graphics interface of centos7

You can see fonts and fonts in the /usr/shared directory. fontconfig directory (it didn’t exist before):

How to solve the garbled graphics interface of centos7

Next, we can add Chinese fonts to our font library.

Add Chinese fonts

In CentOS, the font library is stored in the fonts directory seen in the picture above, so the first thing we have to do is to find the Chinese The font files are placed in this directory, and the Chinese font files can be found in our windows system. Open the Windows/Fonts directory under the c drive:

As shown above, we only need to Just copy the fonts and upload them to the Linux server. Here I choose Song and Hei (these two fonts are used in the report). You can see that there are two files with the suffix ttf and ttc:

How to solve the garbled graphics interface of centos7

Before this we also need to create a new directory. First create a new directory chinese in the /usr/shared/fonts directory:

How to solve the garbled graphics interface of centos7

How to solve the garbled graphics interface of centos7

Then just upload the above two fonts to the /usr/shared/fonts/chinese directory:

How to solve the garbled graphics interface of centos7

Next, you need to modify the permissions of the chinese directory:

chmod -R 755 /usr/share/fonts/chinese

Next, you need to install ttmkfdir to search for all font information in the directory, and summarize and generate the fonts.scale file. Enter the command:

yum -y install ttmkfdir

When you see the prompt message below, the installation has been successful:

How to solve the garbled graphics interface of centos7

Then execute the ttmkfdir command:

ttmkfdir -e /usr/share/X11/fonts/encodings/encodings.dir

The last step is to modify the font configuration file. First open the configuration file through the editor:

vi /etc/fonts/fonts.conf

You can see a Font list, that is, the font list. Here we need to add the Chinese font location Add in:

How to solve the garbled graphics interface of centos7
Then enter: wq to save and exit. Finally, don’t forget to refresh the font cache in the memory, so that you don’t need to reboot:

fc-cache

This way all Even if the steps are completed, finally look at the font list through fc-list again:

How to solve the garbled graphics interface of centos7

You can see that the Chinese font has been successfully installed, and the installation process is complete. At the end, check the report again and you will find that the Chinese style and content can be displayed normally.

Related reference: centOS tutorial

The above is the detailed content of How to solve the garbled graphics interface of centos7. 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's Legacy: Why It Was DiscontinuedCentOS's Legacy: Why It Was DiscontinuedApr 13, 2025 am 12:12 AM

CentOS was terminated because RedHat shifted its focus to CentOSStream, which was used to speed up the RHEL development cycle and drive users to move to RHEL. Alternatives include: 1.RockyLinux, 2.AlmaLinux, 3.OracleLinux. Compatibility, support, and long-term planning are considered when choosing an alternative.

Migration from CentOS: The Best ApproachesMigration from CentOS: The Best ApproachesApr 12, 2025 am 12:13 AM

The best way to migrate from CentOS is to choose RockyLinux, AlmaLinux, or UbuntuServer. 1) Back up data, 2) Evaluate existing systems, 3) Test migration, 4) Perform migration, 5) Verify and optimize to ensure the best system performance.

The Discontinuation of CentOS: A DiscussionThe Discontinuation of CentOS: A DiscussionApr 11, 2025 am 12:09 AM

CentOS has stopped maintaining and has moved to CentOSStream and no longer provides a production-friendly version. Impacts include system migration and enterprise reevaluation of Linux policies. Alternatives are: 1. Migrate to RHEL, 2. Turn to Ubuntu or Debian, 3. Consider CentOSStream as a test platform, 4. Use AlmaLinux or RockyLinux. It is recommended to develop a migration plan as early as possible to evaluate existing system and team needs.

CentOS Automation with Ansible: Infrastructure as CodeCentOS Automation with Ansible: Infrastructure as CodeApr 10, 2025 am 09:40 AM

Use Ansible to implement automated management of CentOS. The specific steps include: 1) writing a playbook to define tasks, such as installing and configuring Apache; 2) executing the playbook through the SSH protocol to ensure consistency of system configuration; 3) using conditional judgment and loop functions to handle complex scenarios; 4) optimizing performance and following best practices, such as using asynchronous tasks and optimizing inventory files.

CentOS Interview Questions: Ace Your Linux System Administrator InterviewCentOS Interview Questions: Ace Your Linux System Administrator InterviewApr 09, 2025 am 12:17 AM

Frequently asked questions and answers to CentOS interview include: 1. Use the yum or dnf command to install software packages, such as sudoyumininstallnginx. 2. Manage users and groups through useradd and groupadd commands, such as sudouseradd-m-s/bin/bashnewuser. 3. Use firewalld to configure the firewall, such as sudofirewall-cmd--permanent-add-service=http. 4. Set automatic updates to use yum-cron, such as sudoyumininstallyum-cron and configure apply_updates=yes.

CentOS Troubleshooting: Diagnosing and Resolving Common IssuesCentOS Troubleshooting: Diagnosing and Resolving Common IssuesApr 08, 2025 am 12:09 AM

How to diagnose and solve common problems in CentOS system? First, check the startup log to solve the failure of system startup; second, check the network configuration file to solve the network problem; finally, use the Yum command to solve the package management problem. Through these steps, you can effectively diagnose and resolve common problems in CentOS systems.

CentOS Security Hardening: Protecting Your Server from IntrudersCentOS Security Hardening: Protecting Your Server from IntrudersApr 07, 2025 am 12:05 AM

CentOS server security reinforcement can be achieved through the following steps: 1. Keep the system software updated and use the "sudoyumupdate-y" command; 2. Disable unnecessary services, such as "sudosystemctldisablecups&&sudosystemctlstopcups"; 3. Configure SELinux as mandatory mode, use the "sudosetenforce1&&sudosed-i's/SELINUX=permissive/SELINUX=enforcing/g'/etc/selinux/config" command; 4. Regularly

Advanced CentOS System Administration: Mastering the Command LineAdvanced CentOS System Administration: Mastering the Command LineApr 06, 2025 am 12:10 AM

Advanced command line management skills of CentOS include: 1. Use systemctl to manage system services, 2. Use top to monitor system resources, 3. Use yum to manage software packages, 4. Use find and xargs to batch process files, 5. Use rsync to optimize file copying. These techniques can improve productivity, solve common problems, and optimize system performance.

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)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

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.