原文链接:Linux:kkFileView v4.0.0 安装、启动教程_Oxye的博客-CSDN博客_kkfileview安装
目录
1.安装 LibreOffice7.1
2.安装 kkFileView
3.修改配置
4.启动
5.问题
预览组件-kkFileView 官网:
https://kkfileview.keking.cn/zh-cn/docs/production.html
官网安装教程较为简单,无4.0.0版的教程
1.安装 LibreOffice7.1
https://gitee.com/kekingcn/file-online-preview/releases 上说,v4.0.0对应LibreOffice7.1
v4.0.0版本发布,LibreOffice7.1底层,兼容性更强,预览效果更好
wget https://kkfileview.keking.cn/LibreOffice_7.1.4_Linux_x86-64_rpm.tar.gz
tar -zxvf LibreOffice_7.1.4_Linux_x86-64_rpm.tar.gz
yum install -y LibreOffice_7.1.4.2_Linux_x86-64_rpm/RPMS/*.rpm
/opt/libreoffice7.1/program/soffice --version
会显示版本号↓
LibreOffice 7.1.4.2 a529a4fab45b75fefc5b6226684193eb000654f6
LibreOffice错误排查,大家可以依次安装下面的组件,查看结果
执行命令:
/opt/libreoffice7.1/program/soffice -help
#错误信息:
/opt/libreoffice7.1/program/soffice.bin: error while loading shared libraries: libcairo.so.2: cannot open shared object file: No such file or directory
#解决方案:
yum install cairo
#错误信息:
/opt/libreoffice7.1/program/soffice.bin: error while loading shared libraries: libcups.so.2: cannot open shared object file: No such file or directory
#解决方案:
yum install cups-libs
#错误信息:
/opt/libreoffice7.1/program/soffice.bin: error while loading shared libraries: libSM.so.6: cannot open shared object file: No such file or directory
#解决方案:
yum install libSM
2.安装 kkFileView
wget https://kkfileview.keking.cn/kkFileView-4.0.0.tar.gz
tar -zxvf kkFileView-4.0.0.tar.gz
解压出一份目录叫 kkFileView-4.0.0
3.修改配置
vi kkFileView-4.0.0/config/application.properties
把office.home改成自己安装的libreoffice7.1
office.home = /opt/libreoffice7.1
如果你本来就有其他版本,可以配了试试,比如
office.home = /opt/libreoffice7.3
LibreOffice端口想改的话改这个
## office转换服务的进程数,默认开启两个进程
office.plugin.server.ports = 2001,2002
4.启动
注意!启动前需要杀掉已启动的libreoffice,下面提供一些指令
查出所有office进程
ps -ef|grep office
kill -9 {pid}
进入kkFileView-4.0.0/config/目录,执行启动脚本
sh startup.sh
查看日志
sh showlog.sh
日志不报很大一段错才是成功,并且会告诉你预览地址
kkFileView 服务启动完成,耗时:6.556363035s,演示页请访问: http://127.0.0.1:8012
把 127.0.0.1 换成服务器ip,就可以打开了
5.问题
启动起不来,报
Caused by: java.lang.IllegalStateException: process with acceptString 'socket,host=127.0.0.1,port=2001' started but its pid could not be found
at org.artofsolving.jodconverter.office.OfficeProcess.start(OfficeProcess.java:90) ~[office-plugin-4.0.0.jar!/:na]
at org.artofsolving.jodconverter.office.OfficeProcess.start(OfficeProcess.java:54) ~[office-plugin-4.0.0.jar!/:na]
at org.artofsolving.jodconverter.office.ManagedOfficeProcess.doStartProcessAndConnect(ManagedOfficeProcess.java:113) ~[office-plugin-4.0.0.jar!/:na]
... 7 common frames omitted
参考下面,把你连接工具的X11功能关掉
https://gitee.com/kekingcn/file-online-preview/issues/I40C4G?_from=gitee_search
Xshell在下图
Mobaxterm 在下图,而且启动时会弹窗询问是否打开x11,要选否