fpt上传centos服务器
[root@uias-test-1-jenkins ~]# cd /usr/local/src/
[root@uias-test-1-jenkins src]# mv /home/xtgl/LibreOffice_7.0.6_Linux_x86-64_rpm.tar.gz .
[root@uias-test-1-jenkins src]# ll
total 43080
-rw-r--r-- 1 xtgl xtgl 262469207 Jun 18 09:27 LibreOffice_7.0.6_Linux_x86-64_rpm.tar.gz
如果安装过LIBREOFFICE,需要先卸载
[root@uias-test-1-jenkins src]# find / -name "libreoffice*" #检测是否有安装过,没有则跳过下一步
[root@uias-test-1-jenkins src]# yum remove libreoffice* #卸载原先的libreoffice软件
[root@uias-test-1-jenkins src]# tar zxvf LibreOffice_7.0.6_Linux_x86-64_rpm.tar.gz #解压
[root@uias-test-1-jenkins src]# mv LibreOffice_7.0.6.2_Linux_x86-64_rpm/ /usr/local/
[root@uias-test-1-jenkins src]# cd /usr/local/
[root@uias-test-1-jenkins local]# cd LibreOffice_7.0.6.2_Linux_x86-64_rpm/
[root@uias-test-1-jenkins LibreOffice_7.0.6.2_Linux_x86-64_rpm]# ll
total 16
-rwxr-xr-x 1 root root 10510 May 7 19:03 install
drwxr-xr-x 2 root root 26 May 7 19:03 readmes
drwxrwxr-x 2 root root 4096 May 7 19:03 RPMS
[root@uias-test-1-jenkins LibreOffice_7.0.6.2_Linux_x86-64_rpm]# cd RPMS/
[root@uias-test-1-jenkins RPMS]# ls #软件依赖所有的rpm包
libobasis7.0-base-7.0.6.2-2.x86_64.rpm
libobasis7.0-calc-7.0.6.2-2.x86_64.rpm
libobasis7.0-core-7.0.6.2-2.x86_64.rpm
libobasis7.0-draw-7.0.6.2-2.x86_64.rpm
libobasis7.0-en-US-7.0.6.2-2.x86_64.rpm
libobasis7.0-extension-beanshell-script-provider-7.0.6.2-2.x86_64.rpm
libobasis7.0-extension-javascript-script-provider-7.0.6.2-2.x86_64.rpm
libobasis7.0-extension-mediawiki-publisher-7.0.6.2-2.x86_64.rpm
libobasis7.0-extension-nlpsolver-7.0.6.2-2.x86_64.rpm
libobasis7.0-extension-pdf-import-7.0.6.2-2.x86_64.rpm
libobasis7.0-extension-report-builder-7.0.6.2-2.x86_64.rpm
libobasis7.0-firebird-7.0.6.2-2.x86_64.rpm
libobasis7.0-gnome-integration-7.0.6.2-2.x86_64.rpm
libobasis7.0-graphicfilter-7.0.6.2-2.x86_64.rpm
libobasis7.0-images-7.0.6.2-2.x86_64.rpm
libobasis7.0-impress-7.0.6.2-2.x86_64.rpm
libobasis7.0-kde-integration-7.0.6.2-2.x86_64.rpm
libobasis7.0-librelogo-7.0.6.2-2.x86_64.rpm
libobasis7.0-libreofficekit-data-7.0.6.2-2.x86_64.rpm
libobasis7.0-math-7.0.6.2-2.x86_64.rpm
libobasis7.0-ogltrans-7.0.6.2-2.x86_64.rpm
libobasis7.0-onlineupdate-7.0.6.2-2.x86_64.rpm
libobasis7.0-ooofonts-7.0.6.2-2.x86_64.rpm
libobasis7.0-ooolinguistic-7.0.6.2-2.x86_64.rpm
libobasis7.0-postgresql-sdbc-7.0.6.2-2.x86_64.rpm
libobasis7.0-python-script-provider-7.0.6.2-2.x86_64.rpm
libobasis7.0-pyuno-7.0.6.2-2.x86_64.rpm
libobasis7.0-writer-7.0.6.2-2.x86_64.rpm
libobasis7.0-xsltfilter-7.0.6.2-2.x86_64.rpm
libreoffice7.0-7.0.6.2-2.x86_64.rpm
libreoffice7.0-base-7.0.6.2-2.x86_64.rpm
libreoffice7.0-calc-7.0.6.2-2.x86_64.rpm
libreoffice7.0-dict-en-7.0.6.2-2.x86_64.rpm
libreoffice7.0-dict-es-7.0.6.2-2.x86_64.rpm
libreoffice7.0-dict-fr-7.0.6.2-2.x86_64.rpm
libreoffice7.0-draw-7.0.6.2-2.x86_64.rpm
libreoffice7.0-en-US-7.0.6.2-2.x86_64.rpm
libreoffice7.0-freedesktop-menus-7.0.6-2.noarch.rpm
libreoffice7.0-impress-7.0.6.2-2.x86_64.rpm
libreoffice7.0-math-7.0.6.2-2.x86_64.rpm
libreoffice7.0-ure-7.0.6.2-2.x86_64.rpm
libreoffice7.0-writer-7.0.6.2-2.x86_64.rpm
[root@uias-test-1-jenkins RPMS]# yum localinstall *.rpm #安装本地安装rpm包
通过查询下面的内容可以找到安装目录
[root@uias-test-1-jenkins RPMS]# which libreoffice7.0
/bin/libreoffice7.0
[root@uias-test-1-jenkins RPMS]# ll /bin/libreoffice7.0
lrwxrwxrwx 1 root root 35 Jun 18 09:58 /bin/libreoffice7.0 -> /opt/libreoffice7.0/program/soffice
首先在主机上的/home目录下,新建一个/kaivi文件夹。在/kaivi文件夹中存放一个word文档(1.docx)。
[root@uias-test-1-jenkins RPMS]# cd /home/kaivi/
[root@uias-test-1-jenkins kaivi]# ll
total 45172
-rw-r--r-- 1 xtgl xtgl 159187 Jun 18 10:03 1.docx
Word文档内容如下:
进入到/home/kaivi/目录中
[root@uias-test-1-jenkins kaivi]# pwd
/home/kaivi
### 通过libreoffice软件把docx文档转换成pdf文档
[root@uias-test-1-jenkins kaivi]# libreoffice7.0 --headless --invisible --convert-to pdf:writer_pdf_Export ./1.docx --outdir ./
[root@uias-test-1-jenkins kaivi]# ll
total 45172
-rw-r--r-- 1 xtgl xtgl 159187 Jun 18 10:03 1.docx
-rw-r--r-- 1 root root 131523 Jun 18 10:08 1.pdf #转化成的pdf文件
## 将转换后的1.pdf文件下载到自己的电脑
[root@uias-test-1-jenkins kaivi]# sz 1.pdf
打开1.pdf文件验证
验证成功。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。