14-CentOS7服务器搭建-OpenOffice

2018-04-29 10:26 阅读

参考文档链接:

wget https://jaist.dl.sourceforge.net/project/openofficeorg.mirror/4.1.3/binaries/zh-CN/Apache_OpenOffice_4.1.3_Linux_x86-64_install-rpm_zh-CN.tar.gz
tar -zxvf Apache_OpenOffice_4.1.3_Linux_x86-64_install-rpm_zh-CN.tar.gz
mv zh-CN Apache_OpenOffice_4.1.3_Linux_x86-64_install-rpm_zh-CN                           // 解压后文件夹为zh-CN,为了方便识别,进行重命名
cd Apache_OpenOffice_4.1.3_Linux_x86-64_install-rpm_zh-CN/RPMS
rpm -Uvih *rpm

自启动

修改脚本文件

vim /etc/rc.d/rc.local

文件末尾增加以下脚本

/opt/openoffice4/program/soffice --accept="socket,host=127.0.0.1,port=8100;urp;StarOffice.ServiceManager" --headless --nofirststartwizard --nologo &

如该文件没有执行权限,则给予执行权限

chmod +x /etc/rc.d/rc.local

以下是使用systemd的方式启动,但会出现cpu占用率100%的情况,先做记录,暂时不用。

创建启动文件

vim /usr/lib/systemd/system/openoffice.service

[Unit]
Description=OpenOffice service
After=syslog.target
[Service]
Environment="JAVA_HOME=/opt/java/default"
ExecStart=/opt/openoffice4/program/soffice --accept="socket,host=127.0.0.1,port=8100;urp;StarOffice.ServiceManager" --headless --nofirststartwizard --nologo
Restart=always
KillSignal=SIGQUIT
Type=simple
StandardError=syslog
NotifyAccess=all
User=tomcat

[Install]
WantedBy=multi-user.target

openoffice自启动

systemctl daemon-reload
systemctl enable openoffice
systemctl start openoffice

LibreOffice

也可以使用LibreOffice作为文档转换服务,但word转html还是要OpenOffice效果好一些。

wget http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/5.2.6/rpm/x86_64/LibreOffice_5.2.6_Linux_x86-64_rpm.tar.gz
tar -zxvf LibreOffice_5.2.6_Linux_x86-64_rpm.tar.gz
cd LibreOffice_5.2.6.2_Linux_x86-64_rpm/RPMS
yum install *.rpm

# 如需卸载,使用以下命令
yum remove libreoffice*

如果使用libreoffice,则启动参数为:

ExecStart=/usr/bin/soffice --accept="socket,host=127.0.0.1,port=8100;urp;StarOffice.ServiceManager" --headless --nofirststartwizard --nologo --nodefault --nocrashreport --nolockcheck
# 或
ExecStart=/usr/bin/soffice --accept="socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" --headless --nofirststartwizard --nologo --nodefault --nocrashreport --nolockcheck  --norestore
# 或
ExecStart=/opt/libreoffice5.2/program/soffice --accept="socket,host=127.0.0.1,port=8100;urp;StarOffice.ServiceManager" --headless --nofirststartwizard --nologo --nodefault --nocrashreport --nolockcheck
QQ咨询
电话
微信
微信扫码咨询