我使用的是Centos mini,字体没有中文的,先安装中文字体
Centos 安装字体文件
# 安装全部字体
# yum -y groupinstall Fonts
# 安装其中一个字体
yum install wqy-microhei-fonts
Ubuntu 安装字体文件
apt install ttf-wqy-zenhei
apt install fonts-wqy-microhei
查看当前支持中文的字体
/usr/share/fonts/ 后面的这个是字体名称
# fc-list :lang=zh
/usr/share/fonts/wqy-microhei/wqy-microhei.ttc: WenQuanYi Micro Hei,文泉驛微米黑:style=Regular
/usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc: WenQuanYi Zen Hei:style=Regular
/usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc: WenQuanYi Zen Hei Sharp,文泉驛點陣正黑:style=Regular
/usr/share/fonts/cjkuni-uming/uming.ttc: AR PL UMing TW MBE:style=Light
/usr/share/fonts/wqy-microhei/wqy-microhei.ttc: WenQuanYi Micro Hei Mono,文泉驛等寬微米黑:style=Regular
/usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc: WenQuanYi Zen Hei Mono:style=Regular
/usr/share/fonts/cjkuni-uming/uming.ttc: AR PL UMing TW:style=Light
/usr/share/fonts/cjkuni-uming/uming.ttc: AR PL UMing HK:style=Light
/usr/share/fonts/cjkuni-uming/uming.ttc: AR PL UMing CN:style=Light
配置火狐浏览器的字体
vim /etc/fonts/conf.d/49-sansserif.conf
修改示例 (只需要修改倒数第四行 wqy-microhei 字体名称,原来是sans-serif)
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--
If the font still has no generic name, add sans-serif
-->
<match target="pattern">
<test qual="all" name="family" compare="not_eq">
<string>sans-serif</string>
</test>
<test qual="all" name="family" compare="not_eq">
<string>serif</string>
</test>
<test qual="all" name="family" compare="not_eq">
<string>monospace</string>
</test>
<edit name="family" mode="append_last">
<string>wqy-microhei</string>
</edit>
</match>
</fontconfig>
重启火狐浏览器