CentOS 下安装 OpenOffice4.0

摘要:
一、更新服务器yum源[root@APP2/]#yumcleanall[root@APP2/]#yummakecache[root@APP2/]#yumupdate1、首先先下载好需要的rpm包:Apache_OpenOffice_4.0.0_Linux_x86-64_install-rpm_zh-CN.tar.gz或直接命令下载:wgethttp://heanet.dl.sourceforge.

一、更新服务器

yum源

[root@APP2/]#yumcleanall

[root@APP2/]#yummakecache

[root@APP2/]#yumupdate

1、首先先下载好需要的rpm包:Apache_OpenOffice_4.0.0_Linux_x86-64_install-rpm_zh-CN.tar.gz

或直接命令下载:wgethttp://heanet.dl.sourceforge.net/project/openofficeorg.mirror/4.0.0/binaries/zh-CN/Apache_OpenOffice_4.0.0_Linux_x86-64_install-rpm_zh-CN.tar.gz

放到服务器的目录下(我放到了opt下)

删除之前安装的OpenOffice

[root@APP2opt]#yumremoveopenoffice*libreoffice*

2、将下载的openoffice解压(我直接解压到opt目录):tar -zxvfApache_OpenOffice_4.0.0_Linux_x86-64_install-rpm_zh-CN.tar.gz

3、解压后生成文件夹zh-CN 进到RPMS目录下,直接yum localinstall *.rpm

4、进入到desktop-integration目录,选择安装相关的套件,我选择的是redhat

rpm -ivh openoffice4.1.1-redhat-menus-4.1.1-9775.noarch.rpm

5、安装完成直接启动Openoffice服务:

进入opt下的openofiice4目录:cd /opt/openoffice4
进入program目录
执行 soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &
完成启动

临时启动 /opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard
一直后台启动 nohup /opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &

windows启动命令:soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard

windows启动命令里面短连接号后面不带空格“ -nofirststartwizard ”
linux启动命令:soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &

6、查看服务是否启动(端口8100是否被soffice占用):netstat -lnp |grep 8100

显示结果:tcp 0 0 127.0.0.1:8100 0.0.0.0:* LISTEN 19501/soffice.bin

7.-安装遇到的问题和解决------原则是缺什么补什么包

1、/opt/openoffice4/program/soffice.bin: error while loading shared libraries: libXext.so.6: cannot open shared object file: No such file or directory

https://pkgs.org/download/libXext.so.6()(64bit)

安装 libXext rpm 或者yum install libXext.i686

如果出现这种情况,说明在/opt/openoffice4/program/下缺少libXext.so.6文件,可以去/usr/lib64 或者 /usr/lib 查看有没有这个文件,如果有就copy到/opt/openoffice4/program/目录里面,如果没有在安装

# yum install libXext.x86_64

2、/opt/openoffice4/program/soffice.bin: error while loading shared libraries: libfreetype.so.6: cannot open shared object file: No such file or directory

找不到libfreetype.so.6文件,同上输入:yum install libfreetype.i686,安装完之后去那两个目录找libXext.so.6复制到/opt/openoffice4/program/目录里面,赋予权限。

3、报问题:no suitable windowing system found, exiting.
输入安装:yum groupinstall "X Window System" ,一路安装完之后重启系统,在启动openoffice服务看看。

4、出现中文乱码

4.1、先从你本机C:WindowsFonts拷贝或者网络上下载你想要安装的字体文件(*.ttf文件)到/usr/share/fonts/chinese/TrueType目录下(如果系统中没有此目录,则自行mkdir创建,亦可重命名为自己喜欢的文件夹名)

4.2、修改字体文件的权限,使root用户以外的用户也可以使用

# cd /usr/share/fonts/chinese/TrueType
# chmod 755 *.ttf

4.3、建立字体缓存

# mkfontscale(如果提示mkfontscale: command not found,需自行安装# yum install mkfontscale)
# mkfontdir
# fc-cache -fv(如果提示fc-cache: command not found,则需要安装# yum install fontconfig)

4.4、重启计算机

8.java调用openOffice服务

1.下载JodConverterhttp://download.csdn.net/detail/kerryzb/9529876

2.java调用

package com.kerryzb.util;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.ConnectException;

import com.artofsolving.jodconverter.DocumentConverter;
import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection;
import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection;
import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter;

public class OfficeToPDF {
/**
* 将Office文档转换为PDF. 运行该函数需要用到OpenOffice, OpenOffice下载地址为
* http://www.openoffice.org/
*
* <pre>
* 方法示例:
* String sourcePath = "F:\office\source.doc";
* String destFile = "F:\pdf\dest.pdf";
* Converter.office2PDF(sourcePath, destFile);
* </pre>
*
* @param sourceFile
* 源文件, 绝对路径. 可以是Office2003-2007全部格式的文档, Office2010的没测试. 包括.doc,
* .docx, .xls, .xlsx, .ppt, .pptx等. 示例: F:\office\source.doc
* @param destFile
* 目标文件. 绝对路径. 示例: F:\pdf\dest.pdf
* @return 操作成功与否的提示信息. 如果返回 -1, 表示找不到源文件, 或url.properties配置错误; 如果返回 0,
* 则表示操作成功; 返回1, 则表示转换失败
*/
public static int office2PDF(String sourceFile, String destFile) throws FileNotFoundException {
try {
File inputFile = new File(sourceFile);
if (!inputFile.exists()) {
return -1;// 找不到源文件, 则返回-1
}
// 如果目标路径不存在, 则新建该路径
File outputFile = new File(destFile);
if (!outputFile.getParentFile().exists()) {
outputFile.getParentFile().mkdirs();
}
// connect to an OpenOffice.org instance running on port 8100
OpenOfficeConnection connection = new SocketOpenOfficeConnection(
"127.0.0.1", 8100);
connection.connect();
// convert
DocumentConverter converter = new OpenOfficeDocumentConverter(
connection);
converter.convert(inputFile, outputFile);
// close the connection
connection.disconnect();
return 0;
} catch (ConnectException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return 1;
}

}

免责声明:文章转载自《CentOS 下安装 OpenOffice4.0》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇c# sleep 例子Embedded Browser(ZFBrowser)使用相关问题下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

在VMware上安装CentOS -7步骤详解

在VMware上安装CentOS -7一、下载好VMware虚拟机   二、准备好CentOS的镜像文件   在这里安装之前博主都已准备好了。 废话就少啰嗦啦!现在开始安装步骤了 1、首先打开VMware创建新的虚拟机 2、选择自定义(高级)后按下一步 3、继续按下一步   4、选择稍后安装操作系统(S),下一步   5、选择客户机操作系统为Linux,...

CentOS 7 中安装 bcc-tools

bcc-tools 需要内核版本为 4.1 或者更新的版本,我们首先需要升级内核 centos版本在7.3以上就不需要update更新了 第一步,升级内核。你可以运行下面的命令来操作: # 升级系统yum update -y# 安装 ELReporpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.o...

CentOS 命令大全

系统 # uname -a               # 查看内核/操作系统/CPU信息 # head -n 1 /etc/issue   # 查看操作系统版本# cat /proc/cpuinfo      # 查看CPU信息# hostname               # 查看计算机名# lspci -tv              # 列...

Centos 安装boost库

1.在http://www.boost.org/下载boost安装包boost_1_65_1.tar.gz 2.在Centos上解压tar -zxvf boost_1_65_1.tar.gz后,cd进入boost_1_65_1目录 3.安装boost库到指定目录 ./b2 install --prefix=/home/dj/lib/boost/  4.如果...

eclipse不自动弹出提示的解决办法(eclipse alt+/快捷键失效)centos 6.7

  1、次方法用于没有一点提示的情况:依次打开eclipse上面的windows ——preferences ——java ——editor —— content assist ,在右上方有一行“select the proposal kinds contained in the 'default' content assist list” 下面,勾选Ja...

Yapi部署

官方文档:https://hellosean1025.github.io/yapi/devops/index.html#%E5%AE%89%E8%A3%85 一:本地开发(可视化部署) npm install -g yapi-cli --registry https://registry.npm.taobao.org # 报错的话需要加上sudo yap...