kkfileview gitee地址
https://gitee.com/kekingcn/file-online-preview
1.下载office组件
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
cd LibreOffice_7.1.4.2_Linux_x86-64_rpm/RPMS
yum install -y *.rpm
安装完成后看下是否安装成功
cd /opt/libreoffice7.1/program
./soffice --version
如果出现
/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 -y cairo
出现
/opt/libreoffice7.1/program/soffice.bin: error while loading shared libraries: libSM.so.6: cannot open shared object file: No such file or directory
执行sudo yum install libSM.x86_64
最后在确认下是否安装成功
./soffice --version
- 安装kkFileview
wget https://kkfileview.keking.cn/kkFileView-4.0.0.tar.gz
tar -zxvf kkFileView-4.0.0.tar.gz
进入修改配置
cd kkFileView-4.0.0/config
vim application.properties
修改office组件地址
office.home = /opt/libreoffice7.1
这里注意,如果你使用的是https 请求则修改,base.url 改成自己的域名地址,http不需要修改
base.url = https://xxx.xxx.com
vim application.properties
创建日志文件
cd kkFileView-4.0.0/log/
touch kkFileView.log
启动kkfileview
cd kkFileView-4.0.0/bin/
./startup.sh | ./showlog.sh
查看是否启动成功
查看网址
常见问题
启动office组件失败,请检查office组件是否可用
office组件启动了,但是总是报错office组件是失败
我这里是因为我先装了openoffice ,后来又装了LibreOffice,导致很乱,我是将openoffice和LibreOffice都卸载了,然后重新安装
卸载步骤:1查看rpm -qa|grep office
2卸载 yum remove libreoffice7.1-writer-7.1.4.2-2.x86_64 -y
3.杀死进程 ps -ef|grep office
查看了kill -9 20995
4.链接x11 禁用
5.重启机器,重新安装