> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/ask/flat/chapter-18-linux-compatibility-layer/di-18.9-jie-wps-office-linux-ban.md).

# 18.9 WPS Office (Linux Version)

WPS Office for Linux is a Linux office suite developed by Kingsoft Software, compatible with Microsoft Office file formats, supporting word processing, spreadsheets, and presentations.

WPS Office does not have a native FreeBSD version, and the WPS in Ports is unmaintained; it needs to be installed through a self-built Linux compatibility layer. This section provides installation and configuration steps based on the Rocky Linux compatibility layer.

> **Warning**
>
> Because this Port is unmaintained, do not use WPS Office from Ports. Please build a compatibility layer yourself before installing and using it.

## Based on Rocky Linux Compatibility Layer (FreeBSD Port)

> **Note**
>
> Please refer to other chapters of this book to complete the installation of the Rocky Linux compatibility layer (FreeBSD Port) first.

The RPM tool is used to install RPM packages into the Rocky Linux compatibility layer in the base system.

### Installing the RPM Tool

Refer to other relevant chapters of this book to install the RPM tool (`pkg install rpm4`).

### Downloading WPS Office

WPS Office official download address: [WPS Office for Linux](https://linux.wps.cn/). Select "64-bit RPM format"

Please obtain a valid link yourself. If using the Firefox browser, you may need to disable the "Enhanced Tracking Protection" feature in the browser's address bar before you can download.

> **Tip**
>
> This link has issues and currently cannot be downloaded via fetch or wget. If you have a solution, please submit a PR or issue.

The file obtained in this article is **wps-office-12.1.2.25882.AK.preread.sw\.Personal-1-663297.x86\_64.rpm**.

### Installing WPS Office

Switch to the compatibility layer path:

```sh
# cd /compat/linux/
```

Install WPS Office:

```sh
# rpm2cpio < /home/ykla/Downloads/wps-office-12.1.2.25882.AK.preread.sw.Personal-1-663297.x86_64.rpm  | cpio -id
```

> **Tip**
>
> The username `ykla`, hostname `ykla`, and path `/home/ykla` shown in the examples in this section are for illustration only; please replace them with actual values for your environment.

Error messages similar to "symlink" are normal. Please replace the path with the actual path of the locally downloaded file.

WPS Office file structure:

```sh
/compat/linux/
└── opt/
     └── kingsoft/
         └── wps-office/
             └── office6/
                  └── wps # WPS executable file
```

### Resolving Dependency Issues

Since dynamic installation via the package manager was not used, dependencies may be abnormal; you must check the dependency items.

Switch to the compatibility layer's shell:

```bash
$ /compat/linux/usr/bin/bash
```

View the dynamic library dependencies of the WPS executable:

```sh
bash-5.1$ ldd /opt/kingsoft/wps-office/office6/wps
        linux-vdso.so.1 (0x00007fffffffe000)
        libdl.so.2 => /lib64/libdl.so.2 (0x0000000801064000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x0000000801069000)
        libtcmalloc_minimal.so.4 => /opt/kingsoft/wps-office/office6/libtcmalloc_minimal.so.4 (0x0000000801600000)
        liblibsafec.so => /opt/kingsoft/wps-office/office6/liblibsafec.so (0x000000080106e000)
        libstdc++.so.6 => /opt/kingsoft/wps-office/office6/libstdc++.so.6 (0x0000000801a00000)
        libm.so.6 => /lib64/libm.so.6 (0x000000080108b000)
        libgcc_s.so.1 => /opt/kingsoft/wps-office/office6/libgcc_s.so.1 (0x0000000801166000)
        libc.so.6 => /lib64/libc.so.6 (0x0000000801e00000)
        /lib64/ld-linux-x86-64.so.2 (0x0000000001021000)
        librt.so.1 => /lib64/librt.so.1 (0x000000080118b000)
```

The output indicates that the dependency libraries are complete.

### Running WPS Office

Launch WPS Office in the Linux compatibility environment with regular user privileges:

```bash
$ /compat/linux/opt/kingsoft/wps-office/office6/wps
```

Accept the software's license agreement and privacy policy:

![FreeBSD WPS](/files/Fb4J7f8LmrLcHKYSeBLg)

Input method working normally.

![FreeBSD WPS](/files/oy4M2QSoT44Frvs5xugd)

Shortcut: Copy **/compat/linux/opt/kingsoft/wps-office/desktops/wps-office-wps.desktop** to the desktop and modify it as follows.

```ini
[Desktop Entry]
Comment=Use WPS Writer to edit articles and reports.
Comment[zh_CN]=使用 WPS 文字编写报告，排版文章
Exec=/compat/linux/opt/kingsoft/wps-office/office6/wps %U
GenericName=WPS Writer
GenericName[zh_CN]=WPS 文字
MimeType=application/wps-office.wps;application/wps-office.wpt;application/wps-office.wpso;application/wps-office.wpss;application/wps-office.doc;application/wps-office.dot;application/vnd.ms-word;application/msword;application/x-msword;application/msword-template;application/wps-office.docx;application/wps-office.dotx;application/rtf;application/vnd.ms-word.document.macroEnabled.12;application/vnd.openxmlformats-officedocument.wordprocessingml.document;x-scheme-handler/ksoqing;x-scheme-handler/ksowps;x-scheme-handler/ksowpp;x-scheme-handler/ksoet;x-scheme-handler/ksowpscloudsvr;x-scheme-handler/ksowebstartupwps;x-scheme-handler/ksowebstartupet;x-scheme-handler/ksowebstartupwpp;application/wps-office.uot3;application/wps-office.uott3;x-scheme-handler/ksodoccenter;application/wps-office.msg;application/wps-office.eml;
Name=WPS Writer
Name[zh_CN]=WPS 文字
StartupNotify=false
Terminal=false
Type=Application
Categories=Office;WordProcessor;Qt;
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=
Icon=wps-office2023-wpsmain
InitialPreference=3
StartupWMClass=wps
```

After granting permissions, it can be used.

## Based on Arch Linux Compatibility Layer

Please refer to other relevant chapters of this book to build the Arch Linux compatibility layer first, then enter the compatibility layer and switch to a regular user:

```sh
# chroot /compat/arch/ /bin/bash # Enter the Arch compatibility layer
# su test # Switch to a regular user to use AUR; at this point, you are in the Arch compatibility layer
```

Start installation:

```sh
$ yay -S wps-office-cn ttf-wps-fonts wps-office-mui-zh-cn # At this point, you are in the Arch compatibility layer; current user is 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  # Enter 1 and press Enter
:: 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 # Enter 1 and press Enter
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')
+
# Enter q to exit
:: Proceed with install? [Y/n] y # Enter y to confirm
==> 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: # Enter the test user's password. If the password is correct but still shows an error, please restart FreeBSD and try again

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 # Enter y to confirm installation
(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 # Install missing dependencies
```

Installation complete.

Fcitx5 input method is temporarily unavailable; this feature awaits further testing. If you have a solution, please provide a reference.

## Based on Ubuntu Compatibility Layer

Please refer to other relevant chapters of this book to build the Ubuntu compatibility layer first, then enter it and install WPS Office:

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

Install dependency packages:

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

Download the WPS Office Debian package:

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

Use the package manager to install WPS Office:

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

Installation complete.

> **Note**
>
> At the time of writing this section, Fcitx5 input method was not working; this feature awaits further testing. If you have a solution, please provide a reference.

## Troubleshooting and Unfinished Items

### Cannot Start

View the dynamic library dependencies of the **/usr/lib/office6/wps** executable:

```sh
# ldd /usr/lib/office6/wps
```

Supplement the missing libraries based on the `ldd` output.

### Requires Root Privileges to Start

Not yet resolved.

### WPS Cannot Start Due to Missing Bash

WPS's startup file needs to call Bash; after installing Bash, it can start normally.

* Install using pkg:

```sh
# pkg install bash
```

* Alternatively, install using Ports:

```sh
# cd /usr/ports/shells/bash/
# make install clean
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.bsdcn.org/ask/flat/chapter-18-linux-compatibility-layer/di-18.9-jie-wps-office-linux-ban.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
