There are multiple options how to install MS Office on Linux.
Wine-based
- Bottles -> didn't work for me, probably because you can't install 32-bit dependencies
- PlayOnLinux -> the Office 2010 script worked for me, Office 2013 script not tested, Office 2016 failed to install with their script. Newer versions not supported.
- Crossover (paid) -> apparently supports Office 2016 and older. I didn't try it but it seems to be the easiest way to get a semi-modern office working in Linux.
VM-based - Integrate Windows apps running in a Windows VM as native-looking in Linux
- Winapps, based on KVM, QEMU, Virt-Manager, and FreeRDP. Still actively maintained (getting Github commits).
- Cassowary, based on KVM, QEMU, Virt-Manager, and FreeRDP. Has a helpful GUI and apparently can auto-suspend the VM when no Windows app is in use.
The latter option means you can run Office 2021 or Office 365 including all apps, but for me it was quite buggy and when I encounterd some (FreeRDP-related?) bug in both Winapps and Cassowary that meant I could only start Excel with an external screen plugged in, I gave up. bug
The first option limits you to Office 2016 and only the core apps (Excel, Powerpoint, Word) are working. Office 2016 is still mostly okay although you're going to miss out on some useful Excel function like IFS, MINIFS, MAXIFS, XLOOKUP, UNIQUE, and SWITCH (see here for a full list).
This guide is largely based on this one from Jaydin which comes with some helpful screenshots.
Step by step guide for Office 2016
Step 0: Get Office
Log in to your Microsoft account, download the MS Office "offline" image (multiple GB, ending in .img) and note down your product key (this can also be found in your Microsoft account at the same place where you download the .img file)
Step 1: Mount the installation disk
For example mkdir ~/msoffice/msoffice2016/image && sudo mount -o loop Office2016HomeStudentRetail.img ~/msoffice/msoffice2016/image/
Step 2: Install Distrobox:
OpenSUSE: sudo zypper install distrobox podman (or install through Yast Software)
OpenSUSE Kalpa/Aeon: already preinstalled
Fedora: sudo dnf install distrobox
Fedora Kinoite/Silverblue: sudo rpm-ostree install distrobox and reboot
Debian 12 & Ubuntu 23.04 and newer: sudo apt install distrobox podman
Arch: sudo pacman -S distrobox podman
For other distros, look here: https://github.com/89luca89/distrobox#installation
Step 3: Set up your container
We will be using a Ubuntu 18.04 container because this is the last version supporting 32-bit packages. Yes, Ubuntu 18.04 is end-of-life and won't get any more security updates, but the same is true for Office 2016.
I would recommend to have a separate /home folder for the distrobox container to avoid mixing files with your normal /home folder. For the below example I have created folder called ~/msoffice/msoffice2016 which I will use as the container's /home folder.
Enter this command to create and enter your Ubuntu 18.04 distrobox:
distrobox-create --name msoffice2016 --image docker.io/library/ubuntu:18.04 --home ~/msoffice/msoffice2016/ && distrobox enter msoffice2016
Step 4: Set up PlayOnLinux in container
Now you're inside the Distrobox container with Ubuntu 18.04. Enter these commands:
sudo dpkg --add-architecture i386
wget -q "http://deb.playonlinux.com/public.gpg" -O- | sudo apt-key add -
sudo wget http://deb.playonlinux.com/playonlinux_bionic.list -O /etc/apt/sources.list.d/playonlinux.list
sudo apt-get update
sudo apt-get install netcat gettext wine-stable:i386 smbclient winbind playonlinux winetricks
winetricks dotnet45
and follow the .NET installation wizard that pops up.
Step 5: Prepare PlayOnLinux
enter the command playonlinux to start PlayOnLinux in the Ubuntu container
Click on Tools -> Manage Wine Versions and in the Wine versions (x86) tab select version 4.15 and click on > to start the installation of this Wine version.
You'll be asked to install Wine Mono and Wine Gecko. Install both.
On the PlayOnLinux main window, click Configure and then New in the bottom left to create a virtual drive.
Select 32 bits windows installation, then Next, then select Wine version 4.15 (not System) and click on Next, then give your drive a name of your choice such as msoffice2016 and click on Next. (The virtual drive will now be set up. Once the virtual drive creation is complete, you should be back in the main PlayOnLinux configuration screen. Ensure the newly created drive (eg msoffice2016) is selected on the left window.)
Click on the Install components tab at the top. Then scroll down to select msxml6 and click Install. Afterwards, scroll down to select riched20 and click Install
Next, go to the Wine tab and click on Configure Wine. A window will pop up.
On the Application tab, make sure the Windows version is set to Windows 7 (should be the default). Then go to the Libraries tab and select msxml6 and click Edit and choose Native then Builtin. Repeat the same for riched20. Then close the small window to return to the PlayOnLinux configuration screen.
Still in the Wine tab, click on Registry Editor. In the registry editor window that popus up, select HKEY_CURRENT_USER -> Software -> Wine on the left, right click on Wine and click Edit -> New Key and name this new key Direct2D. Then right-click the newly created Direct2D key and click Edit -> New -> DWORD Value and name it max_version_factory. Then close the registry editor window to return to the PlayOnLinux configuration screen.
Step 6: Install Office
In the PlayOnLinux configuration screen, click on the Miscellaneous tab and then Run a .exe file in this virtual drive. A file picker will pop up. Navigate yourself to where you have mounted installation disc (in this example /home/user/msoffice/msoffice2016/image/). Enter the Office folder and select the file Setup32.exe.
Now the installation begins. Note that the installer screen doesn't work properly and won't tell you the progress of the installation. If you're lucky you'll get a tray icon that if you click on it will tell you the progress of the installation and at the end will tell you that the installation has finished. If you're unlucky and don't get that tray icon, then wait a sufficient time until you think the installation may have finished, e.g. wait half an hour and monitor if anything is still happening in the terminal or task manager (CPU, disk write).
When the installation is complete, or you think it may have completed, close the PlayOnLinux configuration screen (if window decorations are missing to close the window, use the Alt+F4 shortcut to close it). You'll be back at the main PlayOnLinux screen. Select Tools -> Close all PlayOnLinux software.
Step 7: Finishing up
Start your file manager (e.g. Dolphin or Gnome Files) and go the wineprefix folder set up by PlayOnLinux. In my example this would be in ~/msoffice/msoffice2016/.PlayOnLinux/wineprefix/msoffice2016/ and from there continue navigating to drive_c/Program Files/Common Files/Microsoft Shared/ClickToRun/.
Copy the files AppvIsvSubsystems32.dll and C2R32.dll to drive_c/Program Files/Microsoft Office/root/Office16/
Step 8: Defining apps in PlayOnLinux
Go back to the PlayOnLinux window and click on Configure (make sure msoffice2016 or whatever you named your virtual drive is selected on the left).
Stay on the General tab and click Make a new shortcut from this virtual drive
Now PlayOnLinux will search for .exe files on the virtual drive. Select EXCEL.EXE and name the shortcut Excel, then the wizard starts again, select WINWORD.EXE and name it Word, then select POWERPNT.EXE and name it Powerpoint and lastly select I dont' want to make another shortcut to exit.
Step 9: Test and activate Office
On the PlayOnLinux main screen, you'll now see the three apps Excel, Word and Powerpoint. Click on one of them and then on Run to start the app. Hopefully it will start and run without crashing!
You'll get asked for your product key. Enter the one you got from your Microsoft account or Office.com. Logging in your the Microsoft account from within Office either doesn't work or crash the application, so you won't be able to log in (for Onedrive etc) but Office still says that it's activated when you use the product key.
Step 10: Unmount disc
Close all Office windows, close PlayOnLinux, then leave your Distrobox by typing logout in the terminal.
sudo umount ~/msoffice/msoffice2016/image (adjust path accordingly) to unmount the installation disc.
Step 11: Add .desktop entries
In KDE, right-click on the start menu and select Edit Applications.
Select the Office category and click on New Item.
Define it like this:
Name = Excel
Program = /usr/bin/distrobox
Command-Line Arguments: enter -n msoffice2016 -e 'playonlinux --run Excel'