CentOS7中安装字体,解决运行时中文乱码问题
1、下载字体安装包
fontconfig-2.13.0-4.3.el7.x86_64.rpm
ttmkfdir-3.0.9-42.el7.x86_64.rpm
2、服务器新建路径 /usr/share/fontconfig/myfonts
3、将C://Windows/Fonts 下需要的字体上传到 /usr/share/fontconfig/myfonts
4、给新建目录赋权限
chmod -R 755 /usr/share/fontconfig/myfonts
5、将下载的安装包上传/移动至 /usr/share/fontconfig/myfonts
6、安装离线包
rpm -ivh fontconfig-2.13.0-4.3.el7.x86_64.rpm --nodeps --force
rpm -ivh ttmkfdir-3.0.9-42.el7.x86_64.rpm --nodeps --force
7、执行以下命令,搜索目录中所有的字体信息最后生成一个fonts.scale文件
ttmkfdir -e /usr/share/X11/fonts/encodings/encodings.dir
8、编辑字体配置文件 ,并加入字体路径
vim /etc/fonts/fonts.conf
文件中加入:
<dir>/usr/share/fontconfig/myfonts</dir>
9、运行命令 fc-cache 刷新字体信息
10、命令 fc-list 查验安装的字体是否安装成功