Centos下的LibreOffice安装

安装Centos7之后,系统安装了libreoffice 3.x版本。现在想安装 6.x版本。
在自己的电脑上亲自实验安装成功,下面是每一步操作的纪录

卸载系统当前的libreoffice

执行如下命令:

yum remove libreoffice-*

为了能使用镜像,在etc 目录之下的hosts文件内加入代理。

注意没有加的话,可能第三步无法操作.可不加。

.208.46.146 www.google.com
.208.46.146 dl.google.com
.208.46.146 dl-ssl.google.com

获取rpm文件

http://mirrors.ustc.edu.cn/tdf/libreoffice/stable

选择6.0.3 (可能发布最新版时候就是5.05,目前我使用的是6.0.3)
然后选择rpm然后选择x86_64

http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/6.0.3/rpm/x86_64/

下载3个文件

LibreOffice_6.0.3_Linux_x86-64_rpm.tar.gz
LibreOffice_6.0.3_Linux_x86-64_rpm_sdk.tar.gz
LibreOffice_6.0.3_Linux_x86-64_rpm_langpack_zh-CN.tar.gz

ceontos直接复制代码就行

wget http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/6.0.3/rpm/x86_64/LibreOffice_6.0.3_Linux_x86-64_rpm.tar.gz
wget http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/6.0.3/rpm/x86_64/LibreOffice_6.0.3_Linux_x86-64_rpm_sdk.tar.gz
wget http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/6.0.3/rpm/x86_64/LibreOffice_6.0.3_Linux_x86-64_rpm_langpack_zh-CN.tar.gz

解压文件,执行如下命令

mkdir /usr/libreoffice
tar -zxvf LibreOffice_6.0.3_Linux_x86-64_rpm.tar.gz -C /usr/libreoffice/
tar -zxvf LibreOffice_6.0.3_Linux_x86-64_rpm_sdk.tar.gz -C /usr/libreoffice/
tar -zxvf  LibreOffice_6.0.3_Linux_x86-64_rpm_langpack_zh-CN.tar.gz   -C /usr/libreoffice/

进入到的RPMS目录

上面两个文件解压之后,/usr/libreoffice/下面会有3个文件夹,里面都有一个RPMS文件夹

LibreOffice_6.0.3_Linux_x86-64_rpm
LibreOffice_6.0.3_Linux_x86-64_rpm_sdk
LibreOffice_6.0.3_Linux_x86-64_rpm_langpack_zh-CN

进入到LibreOffice_6.0.3_Linux_x86-64_rpm的rpm ,执行入下命令

cd /usr/libreoffice/LibreOffice_6.0.3_Linux_x86-64_rpm/RPMS

用yum来进行rpm的安装,不要用rpm命令来进行安装

yum localinstall *.rpm

【注意:
因为有 依赖关系 libgnomevfs-2.so.0()(64bit),它被软件包 libobasis5.0-gnome-integration-6.0.3-2.x86_64 需要,所以不要使用rpm命令来进行安装, rpm -ivh *.rpm 命令无法解决上面的依赖系。使用yum遇到上面的依赖关系的时候可以从网络下载相应的包来解决依赖关系。】

到此为止office成功安装了.

安装完成之后,打开office还是会报错,提示找不到libcairo,

[root@localhost uploads]# libreoffice6.0 --invisible --convert-to html test.doc
javaldx: Could not find a Java Runtime Environment!
Warning: failed to read path from javaldx
/opt/libreoffice6.0/program/soffice.bin: error while loading shared libraries: libcairo.so.2: cannot open shared object file: No such file or directory

安装 yum -y install cairo
即可

如果出现如下提示:

 libreoffice6.0  d9755f55-6722-4e74-a7c7-b74f4ac09ec0.docx
Failed to open display
javaldx: Could not find a Java Runtime Environment!
Warning: failed to read path from javaldx
/opt/libreoffice6.0/program/soffice.bin: error while loading shared libraries: libSM.so.6: cannot open shared object file: No such file or directory

下载安装如下 libSM-1.2.2-2:即可

wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libSM-1.2.2-2.el7.i686.rpm
yum -y localinstall libSM-1.2.2-2.el7.i686.rpm 

或者安装
yum -y install libSM
也行

其他的一些需要安装的软件

yum install ibus 安装第三方依赖工具
yum install libreoffice-headless 该工具用来启动Libreoffice

但是我们安装默认是英文版的,所以进行汉化.

这个时候使用这个

LibreOffice_6.0.3_Linux_x86-64_rpm_langpack_zh-CN.tar.gz

进入到LibreOffice_6.0.3_Linux_x86-64_rpm_langpack_zh-CN 文件夹,然后

执行如下命令

yum localinstall *.rpm

打开office之后发现汉化了哦

关于LibreOffice介绍一下:

LibreOffice 能够与 Microsoft Office 系列以及其它开源办公软件深度兼容,且支持的文档格式相当全面

1、文本文档:*.odm, *.sgl, *.odt,*.ott, *.sxw, *.stw, *.fodt, *.xml, *.docx,*.docm, *.dotx, *.dotm, *.doc, *.dot, *.wps, *.pdb, *.hwp, *.html, *.htm, *.lwp, *.psw, *.rft, *.sdw, *.vor, *.txt, *.wpd ,*.oth.

2、电子表格:*.ods, *.ots, *.sxc, *.stc, *.fods, *.xml, *.xlsx, *.xlsm, *.xltm, *.xltx, *.xlsb, *.xls, *.xlc, *.xlm, *.xlw, *.xlk, *.sdc, *.vor, *.dif,*.wk1, *.wks, *.123, *.pxl, *.wb2, *.csv.

3、演示文稿:*.odp, *.otp, *.sti, *.sxd, *.fodp, *.xml, *.pptx, *.pptm, *.ppsx, *.potm, *.potx, *.ppt, *.pps, *.pot, *.sdd, *.vor, *.sdp.

4、绘图:*.odg, *.otg, *.sxd, *.std, *.sgv,*.sda, *.vor, *.sdd, *.cdr, *.svg, *.vsd, *.vst

5、网页:*.html, *.htm, *.stw

6、主控文档:*.sxg

7、公式:*.odf, *.sxm, *.smf, *.mml

8、数据库文档:*. odb

总的来说,LibreOffice的界面没有微软Office那么华丽,但非常简单实用。它的六大组件对应Office丝毫不差,而且对系统配置要求较低,占用资源很少。

libreoffice6.0 完成格式转换
libreoffice6.0 --invisible --convert-to pdf:writer_pdf_Export --outdir  "/root/" "bb.xls"
把test.doc转换成html,保存在test目录
libreoffice6.0 --invisible --convert-to html --outdir ./test test.doc 

https://www.cnblogs.com/dongguolei/p/7902552.html

yum install libreoffice-headless

附上ubutnu下的安装方法

ubuntu安装的软件

wget http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/6.0.3/deb/x86_64/LibreOffice_6.0.3_Linux_x86-64_deb.tar.gz
wget http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/6.0.3/deb/x86_64/LibreOffice_6.0.3_Linux_x86-64_deb_sdk.tar.gz
http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/6.0.3/deb/x86_64/LibreOffice_6.0.3_Linux_x86-64_deb_langpack_zh-CN.tar.gz

tar -zxvf LibreOffice_6.0.3_Linux_x86-64_deb.tar.gz -C /usr/libreoffice/
tar -zxvf LibreOffice_6.0.3_Linux_x86-64_deb_sdk.tar.gz -C /usr/libreoffice/
tar -zxvf  LibreOffice_6.0.3_Linux_x86-64_deb_langpack_zh-CN.tar.gz   -C /usr/libreoffice/

之后进入文件夹,运行如下安装命令即可
sudo dpkg -i *.deb 


报错:

安装
wget http://kr.archive.ubuntu.com/ubuntu/pool/main/libx/libxinerama/libxinerama1_1.1.3-1_amd64.deb
sudo dpkg -i libxinerama1_1.1.3-1_amd64.deb

wget http://ftp.cn.debian.org/debian/pool/main/c/cairo/libcairo2_1.15.10-1_amd64.deb
sudo dpkg -i libcairo2_1.15.10-1_amd64.deb

安装libcairo2_1.15.10-1_amd64.deb会出现有些so文件需要升级,然后就需要升级所需的依赖包
wget http://ftp.cn.debian.org/debian/pool/main/f/fontconfig/libfontconfig1_2.12.6-0.1_amd64.deb
sudo dpkg -i libxinerama1_1.1.3-1_amd64.deb 
以下提示说明有些包的版本过低,需要升级即可,
Selecting previously unselected package libcairo2:amd64.
(Reading database ... 123249 files and directories currently installed.)
Preparing to unpack libcairo2_1.15.10-1_amd64.deb ...
Unpacking libcairo2:amd64 (1.15.10-1) ...
Preparing to unpack libxinerama1_1.1.3-1_amd64.deb ...
Unpacking libxinerama1:amd64 (2:1.1.3-1) over (2:1.1.3-1) ...
dpkg: dependency problems prevent configuration of libcairo2:amd64:
 libcairo2:amd64 depends on libfontconfig1 (>= 2.12); however:
  Version of libfontconfig1:amd64 on system is 2.11.94-0ubuntu1.1.
 libcairo2:amd64 depends on libfreetype6 (>= 2.7.1); however:
  Version of libfreetype6:amd64 on system is 2.6.1-0.1ubuntu2.3.
dpkg: error processing package libcairo2:amd64 (--install):
 dependency problems - leaving unconfigured
Setting up libxinerama1:amd64 (2:1.1.3-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Errors were encountered while processing:
 libcairo2:amd64


你可能感兴趣的:(环境安装)