安装libreoffice:https://blog.csdn.net/an129/article/details/126766228 ###CentOS 7 安装LibreOffice 7.4.0 过程
1、检查当前操作系统环境是否已经安装了LibreOffice。
libreoffice --version
如果已经安装,需要把自带的LibreOffice卸载。
yum remove libreoffice-*
2、进入LibreOffice官网下载rpm安装包,访问地址:
https://zh-cn.libreoffice.org/download/libreoffice/
3、解压并安装LibreOffice。
tar -zxvf ./LibreOffice_7.4.0_Linux_x86-64_rpm.tar.gz cd LibreOffice_7.4.0.3_Linux_x86-64_rpm/RPMS/ yum -y localinstall *.rpm
4、安装libreoffice-headless
yum install -y libreoffice-headless
5、验证LibreOffice是否可用
libreoffice7.4 --version
如果命令可以正常执行显示版本号的话,说明安装成功;若提示缺少so文件的话,需要安装对应的依赖文件。见末尾;
##word转pdf yum install libreoffice-writer 转换命令:libreoffice --headless --convert-to pdf /temp/2.docx --outdir /temp/8.pdf
使用Java转换需要开启服务: cd /opt/libreoffice7.4/program soffice -headless -accept="socket,host=0.0.0.0,port=18100;urp;" -nofirststartwizard &
###安装字体
####windows字体
https://github.com/hushanyi/windows_fonts
####安装步骤:
1、fc -list查看字体库
2、yum -y install fontconfig安装
3、安装好后/usr/share目录下多两个目录fonts和fontconfig
4、首先在/usr/shared/fonts目录下新建一个目录chinese
5、到C:\Windows\Fonts目录下上传你需要的字体到/usr/shared/fonts/chinese目录下
6、修改chinese权限
chmod -R 755 /usr/share/fonts/chinese
7、接下来需要安装ttmkfdir来搜索目录中所有的字体信息,并汇总生成fonts.scale文件,输入命令:
yum -y install ttmkfdir
8、最后一步就是修改字体配置文件了,首先通过编辑器打开配置文件:
vi /etc/fonts/fonts.conf
<!-- Font directory list -->
<dir>/usr/share/fonts</dir>
<dir>/usr/share/X11/fonts/Type1</dir> <dir>/usr/share/X11/fonts/TTF</dir> <dir>/usr/local/share/fonts</dir>
<dir prefix="xdg">fonts</dir>
<dir>/usr/share/fonts/chinese</dir>
<!-- the following element will be removed in the future -->
<dir>~/.fonts</dir>
9、fc-cache 刷新
10、fc-list
##【缺少文件步骤】
6、安装依赖库文件
yum install cairo -y yum install cups-libs -y yum install libSM -y 在这些依赖库文件之中,“libcurl.so.4”库文件的安装过程比较复杂,需要编译安装libcurl才能完成。
7、安装libcurl.so.4库文件
(1)下载安装openssl源代码,https://github.com/openssl/openssl/archive/OpenSSL_1_1_1g.zip
(2)创建安装目录:/opt/openssl
(3)解压所代码压缩包。
unzip openssl-OpenSSL_1_1_1g.zip
(4)编译配置、安装。
cd openssl-OpenSSL_1_1_1g/ ./config --prefix=/opt/openssl --shared make && make install
(5)下载curl源代码,curl - Download
(6)创建安装目录:/opt/libcurl
(7)解压源代码压缩包。
tar -zxvf curl-7.85.0.tar.gz
(8)编译配置、安装。
cd curl-7.85.0 ./configure --prefix=/opt/libcurl --with-ssl=/opt/openssl make && make install
(9)将libcurl.so.4库文件拷贝至/opt/libreoffice7.4/program目录下,覆盖原libcurl.so.4文件。
ln -s /opt/libcurl/lib/libcurl.so.4 /opt/libreoffice7.4/program/libcurl.so.4
(10)设置命令别名。
alias libreoffice='libreoffice7.4'
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。