背景介绍
看了网上很多个写法,但是总跟自己有一些不一样,自己做完以后做一下记录。
安装
Libreoffice
- 首先在官网进行下载对应的版本以及环境
2. 下载完以后我们需要把该文件从windows放到linux(我这边用的是xshell)
- 先用命令安装 yum install lrzsz
- 在通过命令 cd /opt/ 进入该目录进行libreoffice的安装
- 然后在用命令 rz 会有弹窗,然后点击你要移入的文件(这里把安装包移入进来)
- tar -zxvf LibreOffice_7.2.4_Linux_x86-64_rpm.tar.gz 命令进行解压
-
进入目录 cd LibreOffice_7.2.4.1_Linux_x86-64_rpm/RPMS/
-
在该目录进行安装 yum install *.rpm
-
/usr/bin/libreoffice7.2 --headless --accept=”socket,host=127.0.0.1,port=8100;urp;”--nofirststartwizard & 【PS:版本号要对应上你下载的】
-
/opt/libreoffice7.2/program/soffice --accept="socket,host=127.0.0.1,port=8100;urp;" --nofirststartwizard &【上面命令不行,用这个命令】
-
netstat -ntlp 查看你是否启动成功
使用
libreoffice7.2 --convert-to pdf:writer_pdf_Export test.docx 使用该命令进行转换
- test.ppt 是你需要转换的文件