250716-libreoffice-ubuntu安装后配置环境变量office

优先使用此安装方法

1
2
3
4
5
sudo chmod a+wt /tmp 

sudo apt-get update

sudo apt-get install libreoffice

✅✅✅✅一次搞定,成功!✅✅✅✅

soffice默认安装地址

1
2
3
4
5
6
ubuntu@ubuntu:/usr/local/bin$ pwd
/usr/local/bin

ubuntu@ubuntu:/usr/local/bin$ ls -lh
lrwxrwxrwx 1 root root 36 May 2 18:21 libreoffice24.8 -> /opt/libreoffice24.8/program/soffice
lrwxrwxrwx 1 root root 36 Jun 5 18:45 libreoffice25.2 -> /opt/libreoffice25.2/program/soffice

配置软连接

1
2
3
4
5
sudo ln -s /opt/libreoffice24.8/program/soffice /usr/local/bin/libreoffice
sudo ln -s /opt/libreoffice24.8/program/soffice /usr/local/bin/soffice

sudo ln -s /opt/libreoffice25.2/program/soffice /usr/local/bin/libreoffice
sudo ln -s /opt/libreoffice25.2/program/soffice /usr/local/bin/soffice

现在你可以直接运行:

1
2
libreoffice --writer
libreoffice --calc

检测是否安装成功

1
2
3
which libreoffice

# 应该输出 /usr/local/bin/libreoffice 或 /usr/bin/libreoffice

异常问题解决

/opt/libreoffice25.2/program/oosplash: error while loading shared libraries: libXinerama.so.1: cannot open shared object file: No such file or directory

你当前运行的 LibreOffice 报错的根本原因是系统缺少 libXinerama.so.1 这个共享库。

✅ 解决方法(适用于 Ubuntu / Debian 系统):

请直接运行以下命令安装缺失的依赖:

1
2
sudo apt update
sudo apt install libxinerama1

安装完成后,再次执行:

1
soffice --calc

即可正常启动 LibreOffice 计算器模块。


🔍 补充说明:

  • libxinerama1 是 X11 的一个扩展库,用于支持多显示器环境。
  • 如果你之后还遇到类似错误(如 libcairo.so.2libXrender.so.1 等),可以继续用 apt install 缺失库名 的方式解决。

✅ 总结:

报错内容 原因 解决命令
libXinerama.so.1: cannot open shared object file 缺少依赖库 sudo apt install libxinerama1

异常问题解决

error while loading shared libraries: libssl3.so: cannot open shared object file: No such file or directory

1
2
sudo apt update
sudo apt install libssl3

查找文件位置,并配置环境变量

1
2
3
4
find / -name "libssl.so.3"
/usr/lib/x86_64-linux-gnu/libssl.so.3

find / -name "libssl3.so"

创建软链接

1
2
sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so.3 /usr/lib/libssl.so.3
sudo ldconfig

【!!&&】LibreOffice 安装引发的血案

1
2
File \"/usr/local/lib/python3.9/site-packages/unstructured/partition/common.py\", line 160, in convert_office_doc\n  
raise FileNotFoundError(\nFileNotFoundError: soffice command was not found. Please install libreoffice\non your system and try again.

fileNotFoundError(\nFileNotFoundError: soffice command was not found. Please install libreoffice\non your system and try
again.

他提示要安装LibreOffice

于是开始了 LibreOffice 的安装 以下链接是安装步骤 ,我选择了然后解压

Linux 下的安装方法 | LibreOffice 简体中文官方网站 - 自由免费的办公套件

解压 采用tar -zxvf /LibreOffice_7.5.4_Linux_x86-64_deb.tar.gz

报错 tar Not found in archive 然后查了查 解决方案

linux ‘tar: not found in archive‘错误处理_超萌养乐多的博客-CSDN博客

采用 了 ls *.tar.gz |xargs -n1 tar -zxvf指令

解压后安装 dpkg -i ./LibreOffice_7.5.4.2_Linux_x86-64_deb/DEBS/*.deb

但是在使用的时候出现了以下错误

1
2
/opt/libreoffice7.5/program/oosplash: error while loading shared libraries: libXinerama.so.1: cannot open shared object
file: No such file or directory

然后去 查找问题 解决方法是安装 libXineramalinux - error while loading shared libraries: libXinerama.so.1: cannot open
shared object file: No such file or directory - Super User

于是开始安装 apt-get install libxinerama1

后面报 Err:5 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libx11-data all 2:1.6.9-2ubuntu1.2 404 Not
Found [IP: 91.189.91.39 80]
Err:6 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libx11-6 amd64 2:1.6.9-2ubuntu1.2 404 Not
Found [IP: 91.189.91.39 80]

于是又查找问题 说要更新

apt-get update

于是开始更新更新有报错GPG error: http://security.ubuntu.com/ubuntu focal-security InRelease: Couldn’t create temporary
file /tmp/apt.conf.HbA52m for passing config to apt-key

于是进行 apt clean ubuntu 16.04 An error occurred during the signature verification. The repository is not updated
and_Hardy-Lee的博客-CSDN博客

1
2
3
4
5
6
sudo apt-get clean  
cd /var/lib/apt
sudo mv lists lists.old
sudo mkdir -p lists/partial
sudo apt-get clean
sudo apt-get update

还是报错

An error occurred during the signature verification. The repository is not updated and the previous index files will be
used. GPG error: http://archive.ubuntu.com/ubuntu focal InRelease: Couldn’t create temporary file /tmp/apt.conf.gmGfhQ
for passing config to apt-key

于是又去 找问题 W: GPG error: http://security.ubuntu.com/ubuntu bionic-security InRelease: Couldn‘t create
temporary_WangJQ*的博客-CSDN博客

于是 给了 权限 chmod a+wt /tmp

apt-get update 可以更新了 apt-get install libxinerama1 也可以安装了

以为可以万事大吉之后

libreoffice7.5 -version
/opt/libreoffice7.5/program/soffice.bin: error while loading shared libraries: libssl3.so: cannot open shared object
file: No such file or directory

然后 找问题 安装了 apt-get install openssl

还是报错然后再安装

apt-get install libssl-dev

然后 沃日 搞不出来

最后我们回顾下 是安装 LibreOffice

于是我找到https://ubuntu.pkgs.org/22.04/libreoffice-amd64/libreoffice_7.5.4~rc2-0ubuntu0.22.04.1~lo1_amd64.deb.html

这个网站然后

1
2
3
4
5
sudo chmod a+wt /tmp 

sudo apt-get update

sudo apt-get install libreoffice

成功了