本文檔採用deb包方式安裝,操做系統爲ubuntu-16.04.5-server-amd64java
備份原來的源linux
cp /etc/apt/sources.list{,.bak}nginx
更換爲阿里雲的源ubuntu
cat >/etc/apt/sources.list <<EOFvim
deb http://mirrors.aliyun.com/ubuntu/ xenial mainwindows
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main緩存
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main服務器
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main網絡
deb http://mirrors.aliyun.com/ubuntu/ xenial universeless
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe
EOF
apt-get update #更新源
安裝OpenOffice前,務必先卸載ubuntu默認安裝的LibreOffice,不然會發生衝突
apt-get --purge remove libreoffice*
mkdir /usr/local/src/jdk -p
mkdir /usr/local/jdk -p
tar xf /usr/local/src/jdk/server-jdk-8u74-linux-x64.tar.gz -C /usr/local/jdk/
cat >>/etc/profile <<EOF
JAVA_HOME=/usr/local/jdk/jdk1.8.0_74
CLASSPATH=.:\$JAVA_HOME/jre/lib/rt.jar:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar
PATH=\$PATH:\$JAVA_HOME/bin
export JAVA_HOME PATH CLASSPATH
EOF
source /etc/profile
java -version
建立nginx源碼包存放目錄
mkdir /usr/local/src/openoffice
cd /usr/local/src/openoffice
wget https://jaist.dl.sourceforge.net/project/openofficeorg.mirror/4.1.5/binaries/zh-CN/Apache_OpenOffice_4.1.5_Linux_x86-64_install-deb_zh-CN.tar.gz #若是網速很慢,換個網絡環境下載
tar xf Apache_OpenOffice_4.1.5_Linux_x86-64_install-deb_zh-CN.tar.gz
解壓後會在當前目錄裏生成一個zh-CN目錄
cd /usr/local/src/openoffice/zh-CN/DEBS/
dpkg -i *.deb
裝完後會在當前目錄下生成一個desktop-integration目錄
cd /usr/local/src/openoffice/zh-CN/DEBS/desktop-integration/
dpkg -i *.deb
這時openOffice己經安裝完成,默認會安裝在/opt下
ubuntu服務器版本默認沒有圖形界面,須要單獨安裝
因爲openoffice須要圖形界面來支持,因此須要安裝圖形界面軟件
Ubuntu各類圖形界面安裝,參考網址:http://os.51cto.com/art/201003/186844.htm
apt-get install xorg gdm ssh #安裝過程網速會很慢
臨時啓動
/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 &
加入到開機自啓動
vim /etc/rc.local
nohup /opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &
查看openoffice進程
#!/bin/sh # -e 將-e刪除
sleep 3 #添加休息3秒
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# 將要執行的命令放在exit 0以前
export JAVA_HOME=/usr/local/jdk/jdk1.8.0_74
nohup /opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &
exit 0
dpkg -l|grep openoffice
openoffice默認支持的字體比較少,有些字體不支持會出現亂碼問題,須要將window裏的字體放入到Linux中,操做以下。
先停掉openoffice服務
將Windows裏C:\Windows\Fonts文件夾下的全部字體打包,我這裏用的是Windows10裏的字體
建立存放windows字體庫的文件夾,將打包好的字體都放到winfonts文件夾裏
mkdir /usr/share/fonts/winfonts
mkfontscale (建立雅黑字體的fonts.scale文件,它用來控制字體旋轉縮放)
mkfontdir (建立雅黑字體的fonts.dir文件,它用來控制字體粗斜體產生)
fc-cache -fv (創建字體緩存信息,也就是讓系統認識雅黑)
再次啓動openoffice服務器,亂碼便可解決