安装 Apache OpenOffice
前往 Apache OpenOffice 官网下载对应的操作系统安装包;
1
wget https://jaist.dl.sourceforge.net/project/openofficeorg.mirror/4.1.9/binaries/zh-CN/Apache_OpenOffice_4.1.9_Linux_x86-64_install-rpm_zh-CN.tar.gz
解压安装包,得到 zh-CN 文件夹
1
tar zxvf Apache_OpenOffice_4.1.9_Linux_x86-64_install-rpm_zh-CN.tar.gz
进入 zh-CN/RPMS 文件夹,安装所有的 rpm 包
1
rpm -Uivh *.rpm
安装完成后,OpenOffice 的安装路径在 /opt/openoffice4;
启动 OpenOffice
1
/opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &
查看启动结果
1
2netstat -anptl |grep soffice
tcp 0 0 127.0.0.1:8100 0.0.0.0:* LISTEN 1790/soffice.bin
拍错
错误一:
no suitable windowing system found, exiting
,解决方法如下1
yum groupinstall "X Window System"
错误二:
/opt/openoffice4/program/soffice.bin: error while loading shared libraries: libXext.so.6: cannot open shared object file: No such file or directory
,解决方法如下1
yum install libXext
错误三:
/opt/openoffice4/program/soffice.bin: error while loading shared libraries: libfreetype.so.6: cannot open shared object file: No such file or directory
,解决方法如下1
yum install freetype
处理 Word 转 PDF 乱码问题
将 Windows 中常用的中文字体上传到 Linux 系统 /opt/openoffice4/share/fonts/truetype/ 目录
1
2
3# ls /opt/openoffice4/share/fonts/truetype/
arialbd.ttf ariali.ttf ariblk.ttf msyhbd.ttc msyh.ttc simhei.ttf simpbdo.ttf simpo.ttf simsun.ttc
arialbi.ttf arial.ttf javatext.ttf msyhl.ttc simfang.ttf simkai.ttf simpfxo.ttf simsunb.ttf ZWAdobeF.TTF修改系统字体配置文件,添加 OpenOffice 字体库所在目录
1
2
3
4
5
6
7
8
9<!-- Font directory list -->
<dir>/usr/share/fonts</dir>
<dir>/usr/share/X11/fonts/Type1</dir> <dir>/usr/share/X11/fonts/TTF</dir> <dir>/usr/local/share/fonts</dir>
<dir prefix="xdg">fonts</dir>
<dir>/opt/openoffice4/share/fonts/truetype</dir>
<!-- the following element will be removed in the future -->
<dir>~/.fonts</dir>安装字体管理工具
1
yum install -y mkfontscale fontconfig
刷新字体缓存
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18[root@knowledge ~]# cd /usr/share/fonts/
[root@knowledge fonts]# mkfontscale
[root@knowledge fonts]# mkfontdir
[root@knowledge ~]# fc-cache -fv
/usr/share/fonts: 正在生成缓存,新增缓存内容:0 个字体,1 个目录
/usr/share/fonts/dejavu: 正在生成缓存,新增缓存内容:9 个字体,0 个目录
/usr/share/X11/fonts/Type1: 跳过,无此目录
/usr/share/X11/fonts/TTF: 跳过,无此目录
/usr/local/share/fonts: 跳过,无此目录
/root/.local/share/fonts: 跳过,无此目录
/opt/openoffice4/share/fonts/truetype: 正在生成缓存,新增缓存内容:22 个字体,0 个目录
/root/.fonts: 跳过,无此目录
/usr/share/fonts/dejavu: 跳过,探测到循环目录
/usr/lib/fontconfig/cache: cleaning cache directory
/root/.cache/fontconfig: not cleaning non-existent cache directory
/root/.fontconfig: not cleaning non-existent cache directory
/usr/bin/fc-cache-64: 缓存生成成功查看安装的字体
1
2
3
4
5
6
7
8
9
10
11
12[root@knowledge ~]# fc-list :lang=zh
/opt/openoffice4/share/fonts/truetype/msyh.ttc: Microsoft YaHei UI:style=Normal
/opt/openoffice4/share/fonts/truetype/simkai.ttf: KaiTi:style=Regular,Normaali
/opt/openoffice4/share/fonts/truetype/msyhbd.ttc: Microsoft YaHei UI:style=Έντονα
/opt/openoffice4/share/fonts/truetype/simhei.ttf: SimHei:style=Normal
/opt/openoffice4/share/fonts/truetype/simfang.ttf: FangSong:style=Regular,Normaali
/opt/openoffice4/share/fonts/truetype/msyhl.ttc: Microsoft YaHei,Microsoft YaHei Light:style=Light,Regular
/opt/openoffice4/share/fonts/truetype/msyhbd.ttc: Microsoft YaHei:style=Έντονα
/opt/openoffice4/share/fonts/truetype/simsun.ttc: 宋体,SimSun:style=常规,Regular
/opt/openoffice4/share/fonts/truetype/msyh.ttc: Microsoft YaHei:style=Normal
/opt/openoffice4/share/fonts/truetype/msyhl.ttc: Microsoft YaHei UI,Microsoft YaHei UI Light:style=Light,Regular
/opt/openoffice4/share/fonts/truetype/simsun.ttc: 新宋体,NSimSun:style=常规,Regular重启 OpenOffice