KKFileView linux 服务器上的安装

2019-01-11 20:32:45   笔记   被浏览


需要安装如下软件jdk1.8, openOffice, git, maven, redis

一,wget下载jdk,
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-i586.tar.gz

解压
tar -zxvf jdk-8u191-linux-i586.tar.gz


二,安装openOffice
wget https://jaist.dl.sourceforge.net/project/openofficeorg.mirror/4.1.6/binaries/zh-CN/Apache_OpenOffice_4.1.6_Linux_x86-64_install-rpm_zh-CN.tar.gz

[root@iZ25dtd1isiZ openoffice4]# tar -zxvf Apache_OpenOffice_4.1.6_Linux_x86-64_install-rpm_zh-CN.tar.gz
[root@iZ25dtd1isiZ openoffice4]# cd zh-CN
[root@iZ25dtd1isiZ openoffice4]# cd RPMS
[root@iZ25dtd1isiZ openoffice4]# yum -y localinstall *.rpm
[root@iZ25dtd1isiZ openoffice4]# cd desktop-integration
[root@iZ25dtd1isiZ openoffice4]# yum -y localinstall openoffice4.1.6-redhat-menus-4.1.6-9790.noarch.rpm


安装之后,默认会放在目录 /opt/openoffice4
[root@iZ25dtd1isiZ openoffice4]# pwd
/opt/openoffice4
[root@iZ25dtd1isiZ openoffice4]# 
[root@iZ25dtd1isiZ openoffice4]# more start.sh 
# /opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard  
nohup /opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard & 


三 git获取kkfileView
git clone https://github.com/kekingcn/kkFileView.git
也可以直接下载zip包,进行解压,文件目录为 /opt/kkfileview/kkFileView-master


四 安装 maven
wget http://ftp.cuhk.edu.hk/pub/packages/apache.org/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.zip
unzip apache-maven-3.6.0-bin.zip

配置环境变量  /etc/profile
export MAVEN_HOME=/opt/maven/apache-maven-3.6.0
export PATH=$PATH:$MAVEN_HOME/bin


修改配置文件
[root@iZ25dtd1isiZ resources]# more application-dev.properties 
#redis连接
spring.redisson.address = localhost:6379  
spring.redisson.password=xxxx
##资源映射路径
file.dir = /opt/datapreview/
spring.resources.static-locations = classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:${file.dir}
## openoffice home路径
office.home = /opt/openoffice4
server.tomcat.uri-encoding = UTF-8
converted.file.charset = GBK
#文件上传限制
spring.http.multipart.max-file-size=100MB
##文本类型
simText = txt,html,xml,java,properties,mp3,mp4,sql
#多媒体类型
media=mp3,mp4,flv,rmvb
[root@iZ25dtd1isiZ resources]# pwd
/opt/kkfileview/kkFileView-master/jodconverter-web/src/main/resources



安装打包执行
[root@iZ25dtd1isiZ kkFileView-master]# pwd
/opt/kkfileview/kkFileView-master
[root@iZ25dtd1isiZ kkFileView-master]# 
[root@iZ25dtd1isiZ kkFileView-master]# ls
jodconverter-core  jodconverter-web  LICENSE  pom.xml  README.en.md  README.md
[root@iZ25dtd1isiZ kkFileView-master]# mvn clean install  --这里要下包需要很长时间
[root@iZ25dtd1isiZ kkFileView-master]# mvn package

[root@iZ25dtd1isiZ target]# pwd
/opt/kkfileview/kkFileView-master/jodconverter-web/target
[root@iZ25dtd1isiZ target]# more start.sh 
/opt/java/jdk1.8.0_191/bin/java -jar jodconverter-web-1.5.8.RELEASE.jar cn.keking.FilePreviewApplication &

[root@iZ25dtd1isiZ target]# netstat -an|grep 8012
tcp        0      0 0.0.0.0:8012                0.0.0.0:*                   LISTEN

看到如上端口已经监听,即可访问预览

解决中文乱码:
yum groupinstall chinese-support

预览效果