现象与原因分析

执行fc-list查看系统字体
经分析发现,linux默认不带中文字体,因此打开我们本地的windows系统的TTF、TTC字体安装到centos机器上。
安装字体
将Windows的路径: C:\Windows\Fonts 的中文字体,如扩展名为 TTC 与TTF的所有文字上传到Centos服务器,在/usr/share/fonts目录新建chinese目录,将上述中文字体上传到/usr/share/fonts/chinese目录下
powershell
[root@jpaas-app01 ~]#cd /usr/share/fonts/
[root@jpaas-app01 ~]#mkdir chinese
[root@jpaas-app01 ~]# 上传字体到chinese 并给chinese目录加 755 权限
[root@jpaas-app01 ~]#chmod -R 755 chinese/
[root@jpaas-app01 ~]# ls /usr/share/fonts/chinese/
安装ttmkfdir
ttmkfdir是用来搜索目录中所有的字体信息,并汇总生成fonts.scale文件的
powershell
yum -y install ttmkfdir
安装ttmkfdir后,执行如下ttmkfdir命令:
powershell
[root@jpaas-app01 chinese]# ttmkfdir -e /usr/share/X11/fonts/encodings/encodings.dir
修改字体配置文件,将我们的字体目录/usr/share/fonts/chinese加入到/etc/fonts/fonts.conf配置文件中,如下:
powershell
[root@nb003 chinese]# vi /etc/fonts/fonts.conf

刷新内存中的字体缓存
powershell
[root@jpaas-app01 ~]# fc-cache
最后,再次查看字体库,发现多了很多ttf与ttc的字体,至止,字体安装成功:
fc-list
重启openoffice服务
powershell
ps -ef|grep office
kill -i 进程ID
#重启openoffice
nohup /opt/openoffice4/program/soffice -headless -accept="socket,host=172.16.1.111,port=8100;urp;" -nofirststartwizard &
ip可以改为0.0.0.0,将不限制IP进行转换,否则可以会出现conection refuse的错误。