Centos7下安装openOffice

xiaohai 2022-06-13 15:43:06 1602人围观 标签: office 
简介OpenOffice.org 是一套跨平台的办公室软件套件,能在Windows、Linux、MacOS X (X11)和 Solaris 等操作系统上执行。它与各个主要的办公室软件套件兼容。OpenOffice.org 是免费软件,任何人都可以免费下载、使用及推广它。

一、安装OpenOffice

1、安装环境
Centos 8
2、下载OpenOffice
wget https://udomain.dl.sourceforge.net/project/openofficeorg.mirror/4.1.12/binaries/zh-CN/Apache_OpenOffice_4.1.12_Linux_x86-64_install-deb_zh-CN.tar.gz
3、解压
tar -zxvf Apache_OpenOffice_4.1.12_Linux_x86-64_install-rpm_zh-CN.tar.gz
4、进入zh-CN文件夹下的RPMS目录下,执行yum localinstall *.rpm安装必要的包
cd zh-CN/RPMS/

yum localinstall *.rpm
6、安装完成后在当前目录下会生成一个desktop-integration,进入该目录,并安装
cd desktop-integration/

yum localinstall openoffice4.1.12-redhat-menus-4.1.12-9809.noarch.rpm

二、启动OpenOffice

1、临时启动
soffice --headless --accept="socket,host=127.0.0.1,port=8100;urp;" --nofirststartwizard
2、后台启动
nohup soffice --headless --accept="socket,host=127.0.0.1,port=8100;urp;" --nofirststartwizard &
3、开机启动
vim /etc/rc.local

nohup soffice --headless --accept="socket,host=127.0.0.1,port=8100;urp;" --nofirststartwizard &

三、验证是否启动成功

[root@localhost ~]# netstat -ntlp|grep 8100
tcp        0      0 127.0.0.1:8100          0.0.0.0:*               LISTEN      1489657/soffice.bin


[root@localhost ~]# ps -ef|grep office
root     1489633 1489338  0 16:13 pts/0    00:00:00 /opt/libreoffice7.1/program/oosplash --headless --accept=socket,host=127.0.0.1,port=8100;urp; --nofirststartwizard
root     1489657 1489633  0 16:13 pts/0    00:00:00 /opt/libreoffice7.1/program/soffice.bin --headless --accept=socket,host=127.0.0.1,port=8100;urp; --nofirststartwizard
root     1489734 1489502  0 16:16 pts/1    00:00:00 grep --color=auto office

四、使用命令转pdf

soffice --headless --invisible --convert-to pdf path/to/officefile --outdir path/to/outdir

path/to/officefile:office文件地址
path/to/outdir:输出目录