Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to install fonts for linux

Shulou Source: shulou.com Published: 2022-05-31 11:21:36 10月03日 Update

This article will explain in detail how to install fonts for linux, the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

Method: 1, use the "cp specified font file / usr/share/fonts/" command to copy the font file to the specified directory; 2, use the "cd / usr/share/fonts/ mkfontscale mkfontdir fc-cache" command to install the font.

The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How to install fonts in linux

First, view the system font

Before starting the installation, let's check the fonts that have been installed on the system.

To see the fonts that are already installed on the system, we can use the fc-list command to view them. If the command is not available on the system, we need to install the relevant software package first.

On centos, use the following command to install:

Yum install-y fontconfig mkfontscale

On ubuntu, use the following command to install:

Sudo apt-get-y install fontconfig xfonts-utils

Once installed, we can use the fc-list command to view the fonts that have been installed on the system. As follows:

Cat / etc/issue

Fc-list

The above picture shows the font that has been installed by default on centos6.

The above picture shows the font that has been installed by default on ubuntu.

To view the Chinese fonts that have been installed on the system, we can use the following command:

Fc-list: lang=zh

From the image above, we can see that centos6 and ubuntu do not have Chinese fonts installed by default.

Second, install fonts

Through the first chapter, we know that there is no Microsoft elegant black font in the system at present. We now need to upload the MSYH.TTF file to the linux server. As follows:

All the files in the C:\ Windows\ Fonts directory can be packaged and uploaded, and can still be used in the following ways (tested)

The method of installing fonts on centos is the same as on ubuntu, we just need to do the relevant operations. Copy MSYH.TTF to the / usr/share/fonts/ directory, using the following command: cd / root/cp MSYH.TTF / usr/share/fonts/

Then set up the font index information and update the font cache, using the following command: cd / usr/share/fonts/mkfontscalemkfontdirfc-cache

At this point, the font has been installed.

Now let's check whether the Microsoft yahaki font has been installed successfully, using the following command: fc-list: lang=zh

On how to install fonts on linux to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Fonts commands systems files pictures above directories Microsoft Chinese fonts content articles methods more knowledge articles Chinese good success information situation tutorials Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi MySQL Huawei Docker vpn