红联Linux门户
Linux帮助

在Ubuntu Kylin14.04/14.10里安装LibreOffice 4.3.1的简单脚本

发布时间:2015-04-15 10:41:33来源:ubuntukylin作者:ping-wu

将下面的指令用gedit复制成一个脚本档案(假设是 LO431.sh):

#!/bin/bash
# Remove existing LibreOffice
sudo apt-get remove libreoffice*
# Download and unpack LibreOffice 4.3.1
wget -qO - http://ftp.osuosl.org/pub/tdf/libreoffice/stable/4.3.1/deb/x86_64/LibreOffice_4.3.1_Linux_x86-64_deb.tar.gz | tar xz
# Install LibreOffice 4.3.1
sudo dpkg -i LibreOffice_4.3.1.2_Linux_x86-64_deb/DEBS/*.deb
# Download and unpack Chinese User Interface
wget -qO - http://download.documentfoundation.org/libreoffice/stable/4.3.1/deb/x86_64/LibreOffice_4.3.1_Linux_x86-64_deb_langpack_zh-CN.tar.gz | tar xz
# Install Chinese User Interface
sudo dpkg -i LibreOffice_4.3.1.2_Linux_x86-64_deb_langpack_zh-CN/DEBS/*.deb

把这个脚本设为可执行档案:

chmod +x LO431.sh

然后执行这个脚本:

bash LO431.sh

就可以从Dash里执行 LibreOffice 4.3.1了。

这个脚本包括自动下载200多MB的档案,会花一点时间,请稍微有一点耐心。

另外,UK1410虽然有4.3版本的LibreOffice,但因为Ubuntu版的LibreOffice并不是完整版,同时Ubuntu Unity 的 global menabar有时候还是会出问题,建议也执行上述的脚本,安装官方版的LibreOffice。


有些人可能对让电脑静静不动一二十分钟,会感觉怪怪的。如果是这样的话,可以尝试下面的脚本:

#!/bin/bash
# Uninstall LibreOffice
sudo apt-get remove libreoffice*
# Download LibreOffice 4.3.1
wget -cO LO431.tar.gz http://ftp.osuosl.org/pub/tdf/libreoffice/stable/4.3.1/deb/x86_64/LibreOffice_4.3.1_Linux_x86-64_deb.tar.gz
# Creating a simplified directory LO431
mkdir LO431
# Unpack LO431.tar.gz
tar --strip-component 1 -xzvC LO431 -f LO431.tar.gz
# Install LibreOffice 4.3.1
sudo dpkg -i LO431/DEBS/*.deb
# Download Chinese User Interface
wget -qO LO431CN.tar.gz http://download.documentfoundation.org/libreoffice/stable/4.3.1/deb/x86_64/LibreOffice_4.3.1_Linux_x86-64_deb_langpack_zh-CN.tar.gz | tar xz
# Creating a simplified directory LO431CN
mkdir LO431CN
# Unpack LO431CN.tar.gz
tar --strip-component 1 -xzvC LO431CN -f LO431CN.tar.gz
# Install Chinese User Interface
sudo dpkg -i LO431CN/DEBS/*.deb

这个脚本可以存起来一次执行,或把里面的指令照顺序单独执行。


如果不想用root的权限把LibreOffice 4.3.1装置在系统里的话,可以用下列的脚本,装置到家目录的LibreOffice-4.3.1档案夹里面,跟原有的版本完全不冲突。

#!/bin/bash
# Creating three working directories in User's Home Directory
cd $HOME; mkdir LO431 LO431CN LibreOffice-4.3.1
# Download LibreOffice 4.3.1
wget -cO LO431.tar.gz http://ftp.osuosl.org/pub/tdf/libreoffice/stable/4.3.1/deb/x86_64/LibreOffice_4.3.1_Linux_x86-64_deb.tar.gz
# Unpack LO431.tar.gz
tar --strip-component 1 -xzvC LO431 -f LO431.tar.gz
# Install LibreOffice 4.3.1 with user's own privilege
for i in LO431/DEBS/*.deb; do dpkg-deb -xv $1 $HOME/LibreOffice-4.3.1; done
# Download Chinese User Interface
wget -qO LO431CN.tar.gz http://download.documentfoundation.org/libreoffice/stable/4.3.1/deb/x86_64/LibreOffice_4.3.1_Linux_x86-64_deb_langpack_zh-CN.tar.gz | tar xz
# Unpack LO431CN.tar.gz
tar --strip-component 1 -xzvC LO431CN -f LO431CN.tar.gz
# Install Chinese User Interface
for i in LO431CN/DEBS/*.deb; do dpkg-deb -xv $1 $HOME/LibreOffice-4.3.1; done
# Make this program portable:
cd $HOME/LibreOffice-4.3.1/opt/libreoffice4.3/program/
chmod +w bootstraprc
sed -i 's/SYSUSERCONFIG\/libreoffice\/4/ORIGIN\/../g' bootstraprc
chmod -w bootstraprc

这个方法所做出来的LibreOffice 4.3.1套件乃是属于可携带的(portable),可以放到U棒里使用。