1.安装 LiberOffice
命令下载
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
2.验证office是否安装成功
cd /opt/libreoffice7.1/program
./soffice --version
如果顺利成功,此时可以看到一串版本号如下 【LibreOffice 7.1.4.2 a529a4fab45b75fefc5b6226684193eb000654f6】
3.安装kkfileview
wget https://kkfileview.keking.cn/kkFileView-4.0.0.tar.gz
tar -zxvf kkFileView-4.0.0.tar.gz
4.安装office组件(报错提示:启动office组件失败,请检查office组件是否可用)
$ cd kkFileView/bin/
$ ./install.sh
5.安装成功如图所示
6.配置kkfileview参数
$ vim kkFileView-4.1.0/config/application.properties
#######################################不可动态配置,需要重启生效#######################################
server.port = ${KK_SERVER_PORT:8012}
server.servlet.context-path= ${KK_CONTEXT_PATH:/}
server.servlet.encoding.charset = utf-8
#文件上传限制
spring.servlet.multipart.max-file-size=500MB
spring.servlet.multipart.max-request-size=500MB
# office-plugin
## office转换服务的进程数,默认开启两个进程
office.plugin.server.ports = 2001,2002
## office 转换服务 task 超时时间,默认五分钟
office.plugin.task.timeout = 5m
#预览生成资源路径(默认为打包根路径下的file目录下)
#file.dir = D:\\kkFileview\\
file.dir = ${KK_FILE_DIR:default}
#允许预览的本地文件夹 默认不允许任何本地文件被预览
#file.dir = D:\\kkFileview\\
local.preview.dir = ${KK_LOCAL_PREVIEW_DIR:default}
#openoffice home路径
#office.home = D:\\soft\\OpenOffice4
office.home = ${KK_OFFICE_HOME:default}
#缓存实现类型,不配默认为内嵌RocksDB(type = default)实现,可配置为redis(type = redis)实现(需要配置spring.redisson.address等参数)和 JDK 内置对象实现(type = jdk),
cache.type = ${KK_CACHE_TYPE:jdk}
#redis连接,只有当cache.type = redis时才有用
spring.redisson.address = ${KK_SPRING_REDISSON_ADDRESS:127.0.0.1:6379}
spring.redisson.password = ${KK_SPRING_REDISSON_PASSWORD:}
#缓存是否自动清理 true 为开启,注释掉或其他值都为关闭
cache.clean.enabled = ${KK_CACHE_CLEAN_ENABLED:true}
#缓存自动清理时间,cache.clean.enabled = true时才有用,每天凌晨3点清理
cache.clean.cron = ${KK_CACHE_CLEAN_CRON:0 0 3 * * ?}
7.启动服务
$ cd /opt/file-preivew/kkFileView-4.1.0-SNAPSHOT/bin
$ ./startup.sh | ./showlog.sh
8.访问服务