Skip to content

11.11 WPS Office(Linux 版)

WPS Office for Linux 是金山软件公司开发的 Linux 办公套件,兼容 Microsoft Office 文件格式,支持文字处理、电子表格和演示文稿等功能。

WPS Office 没有原生 FreeBSD 版本,且 Ports 中的 WPS 已无人维护,需通过自行构建的 Linux 兼容层安装。本节基于 Rocky Linux 兼容层给出安装与配置步骤。

警告

因为该 Port 已无人维护,请勿使用 Ports 中的 WPS Office。请自行构建兼容层后安装使用。

11.11.1 基于 Rocky Linux 兼容层(FreeBSD Port)

注意

请先参考本书其他章节完成 Rocky Linux 兼容层(FreeBSD Port)的安装。

11.11.1.1 安装 RPM 工具

使用 pkg 安装:

sh
# pkg install rpm4

或者使用 Ports 方式安装:

sh
# cd /usr/ports/archivers/rpm4/
# make install clean

11.11.1.2 下载 WPS Office

WPS Office 官方下载地址:WPS Office for Linux

请自行获取有效链接。

技巧

该链接存在问题,目前无法通过 fetch 或 wget 下载。如有解决方案,请提交 PR 或 issue。

11.11.1.3 安装 WPS Office

切换到兼容层路径:

sh
# cd /compat/linux/

安装 WPS Office:

sh
# rpm2cpio < /home/ykla/Downloads/wps-office-12.1.0.17900-1.x86_64.rpm  | cpio -id

请将路径替换为本地下载文件的实际路径。

WPS Office 文件结构:

sh
/compat/linux/
└── opt/
    └── kingsoft/
        └── wps-office/
            └── office6/
                └── wps # WPS 可执行文件

11.11.1.4 解决依赖问题

查看依赖:

bash
# /compat/linux/usr/bin/bash # 切换到兼容层的 shell
bash-5.1# ldd /opt/kingsoft/wps-office/office6/wps	# 查看 WPS 可执行文件的动态库依赖
	linux-vdso.so.1 (0x00007fffffffe000)
	libdl.so.2 => /lib64/libdl.so.2 (0x000000080105c000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x0000000801061000)
	libtcmalloc_minimal.so.4 => /opt/kingsoft/wps-office/office6/libtcmalloc_minimal.so.4 (0x0000000801600000)
	liblibsafec.so => /opt/kingsoft/wps-office/office6/liblibsafec.so (0x0000000801066000)
	libstdc++.so.6 => /opt/kingsoft/wps-office/office6/libstdc++.so.6 (0x0000000801a00000)
	libm.so.6 => /lib64/libm.so.6 (0x0000000801083000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x000000080115e000)
	libc.so.6 => /lib64/libc.so.6 (0x0000000801e00000)
	/lib64/ld-linux-x86-64.so.2 (0x0000000001021000)
	librt.so.1 => /lib64/librt.so.1 (0x0000000801179000)

输出表明依赖库已经齐全。

11.11.1.5 运行 WPS Office

使用普通用户权限在 Linux 兼容环境中启动 WPS Office:

bash
$ export QT_IM_MODULE=fcitx
$ /compat/linux/opt/kingsoft/wps-office/office6/wps

FreeBSD WPS

输入法正常。

FreeBSD WPS

11.11.2 基于 Arch Linux 兼容层

sh
# chroot /compat/arch/ /bin/bash # 进入 Arch 兼容层
# passwd # 为 Arch 的 root 设置密码
# passwd test # 为 Arch 的 test 用户设置密码,该用户已由脚本创建

请新开一个终端并输入 reboot 重启 FreeBSD,否则新设置的密码无法生效。

sh
# chroot /compat/arch/ /bin/bash # 进入 Arch 兼容层
# su test # 此时位于 Arch 兼容层!切换到普通用户才能使用 AUR

开始安装:

sh
$ yay -S wps-office-cn ttf-wps-fonts wps-office-mui-zh-cn # 此时位于 Arch 兼容层!此时用户为 test
AUR Explicit (2): wps-office-cn-11.1.0.11698-1, ttf-wps-fonts-1.0-5
:: (1/1) Downloaded PKGBUILD: ttf-wps-fonts
  2 wps-office-cn                            (Build Files Exist)
  1 ttf-wps-fonts                            (Build Files Exist)
==> Packages to cleanBuild?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> 1  # 这里输入 1 回车
:: Deleting (1/1): /home/test/.cache/yay/ttf-wps-fonts
HEAD is now at ba3222c Add upstream URL
  2 wps-office-cn                            (Build Files Exist)
  1 ttf-wps-fonts                            (Build Files Exist)
==> Diffs to show?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> 1 # 这里输入 1 回车
diff --git /home/test/.cache/yay/ttf-wps-fonts/.gitignore /home/test/.cache/yay/ttf-wps-fonts/.gitignore
new file mode 100644
index 0000000..12be320
--- /dev/null
+++ /home/test/.cache/yay/ttf-wps-fonts/.gitignore
@@ -0,0 +1,5 @@
+*.pkg.tar.xz
+*.src.tar.gz
+src/
+pkg/
+
diff --git /home/test/.cache/yay/ttf-wps-fonts/PKGBUILD /home/test/.cache/yay/ttf-wps-fonts/PKGBUILD
new file mode 100644
index 0000000..21a51bb
--- /dev/null
…………
+url="https://github.com/IamDH4/ttf-wps-fonts"
+source=("$pkgname.zip::https://github.com/IamDH4/$pkgname/archive/master.zip"
+        "license.txt")
+sha1sums=('cbc7d2c733b5d3461f3c2200756d4efce9e951d5'
+          '6134a63d775540588ce48884e8cdc47d4a9a62f3')
+
# 这里输入 q
:: Proceed with install? [Y/n] y # 这里输入 y 回车
==> Making package: ttf-wps-fonts 1.0-5 (Thu Jul  6 06:23:35 2023)
…………
==> Leaving fakeroot environment.
==> Finished making: wps-office-cn 11.1.0.11698-1 (Thu Jul  6 06:37:32 2023)
==> Cleaning up...

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

For security reasons, the password you type will not be visible.

[sudo] password for test: # 输入 test 用户的密码。如果密码正确但仍提示错误,请重启 FreeBSD 系统后重新执行以上操作

Packages (2) ttf-wps-fonts-1.0-5  wps-office-cn-11.1.0.11698-1

Total Installed Size:  1370.17 MiB

:: Proceed with installation? [Y/n] y # 这里输入 y 确认安装
(2/2) checking keys in keyring                                      [######################################] 100%
(2/2) checking package integrity                                    [######################################] 100%
…………
(2/2) installing ttf-wps-fonts                                      [######################################] 100%
:: Running post-transaction hooks...
(1/4) Arming ConditionNeedsUpdate...
(2/4) Updating fontconfig cache...
(3/4) Updating the desktop file MIME type cache...
(4/4) Updating X fontdir indices...
[test@ykla ~]$ exit
# pacman -S libxcomposite # 安装缺失的依赖

安装完毕。

Fcitx5 输入法暂时无法使用,功能待后续测试。如有解决方法,请提供参考。

11.11.3 基于 Ubuntu 的兼容层

进入 Ubuntu 兼容层:

sh
# chroot /compat/ubuntu/ /bin/bash

安装依赖包:

bash
# apt install bsdmainutils xdg-utils libxslt1.1 libqt5gui5 xcb

下载 WPS Office Debian 安装包:

sh
# wget https://wps-linux-personal.wpscdn.cn/wps/download/ep/Linux2019/11698/wps-office_11.1.0.11698_amd64.deb

调用包管理器安装 WPS Office:

bash
# apt install ./wps-office_11.1.0.11698_amd64.deb

安装完毕。

注意

本节撰写时,Fcitx5 输入法未生效,功能待后续测试。如有解决方法,请提供参考。

11.11.4 故障排除与未竟事宜

11.11.4.1 无法启动

查看 /usr/lib/office6/wps 可执行文件的动态库依赖:

sh
# ldd /usr/lib/office6/wps

根据 ldd 输出补充缺失的库。

11.11.4.2 需要 root 权限才能启动

尚未解决。

11.11.4.3 由于缺少 Bash 导致 WPS 无法启动

WPS 的启动文件需要调用 Bash,安装 Bash 后即可正常启动。

  • 使用 pkg 安装:
sh
# pkg install bash
  • 或者使用 Ports 安装:
sh
# cd /usr/ports/shells/bash/
# make install clean