There are multiple options how to install MS Office on 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. Last release in Feb 2022 and seems to be abandoned.
The VM-based options means 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
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.
The Wine-based options limit you to Office 2016 or older and only the core apps (Excel, Powerpoint, Word) are working. Office 2016 is still mostly okay and quite similar to the newest Office versions, 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.
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)
For example mkdir ~/msoffice/msoffice2016/image && sudo mount -o loop Office2016HomeStudentRetail.img ~/msoffice/msoffice2016/image/
- 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
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 and to make backup and restore easier. 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
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.
Still in the Distrobox, 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
, thenNext
- 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 onNext
. (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 (egmsoffice2016
) 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 selectmsxml6
and clickEdit
and chooseNative then Builtin
. Repeat the same forriched20
. - Then go to the
Graphics
tab and potentially bring up theScreen resolution
. The default is 96 dpi which looks way too small on my HiDPI screen and 144 dpi works much better. 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 onWine
and clickEdit -> New Key
and name this new keyDirect2D
. - Then right-click the newly created
Direct2D
key and clickEdit -> New -> DWORD Value
and name itmax_version_factory
. Then close the registry editor window to return to the PlayOnLinux configuration screen.
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
.
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/
.
Find the files AppvIsvSubsystems32.dll
and C2R32.dll
and copy them to drive_c/Program Files/Microsoft Office/root/Office16/
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.
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.
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.
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'
(where msoffice2016 is the name of your Distrobox container)
In Gnome or Xfce you may have to define your .desktop files manually, like described here. It should read Exec=/usr/bin/distrobox enter -n msoffice2016 -e 'playonlinux --run Excel'
Then do the same for Word and Powerpoint.
If you want, you can add logos as well (download them from Wikipedia for example).
Now, next time you see e.g. an .xlsx
file you can right-click on the file -> Open With -> Other Application -> Office -> Excel
(this is the example for Dolphin, if you use another file manager it will probably be similar). Or to set it as the default, right-click on the file -> Properties
-> General
tab -> Change
button next to "Open With: ..." and select Excel the same way (again, this is for Dolphin). Repeat the same for .docx
(Word) and .pptx
(Powerpoint). Or if you have KDE Plasma as your desktop, do it from KDE System Settings -> Applications -> File Associations
instead.
By default Excel will use American settings, for example if you enter 1/12/23 Excel will think it is the 12th of January rather than the 1st of December. Or if you're European you'll want to use "." as a thousand separator and "," as a decimal separator rather than the other way round. To fix stuff like this:
Start PlayOnLinux in Distrobox again with distrobox enter msoffice2016 && playonlinux
Start the registry editor again (go to Configure
-> select the msoffice2016
virtual drive on the left -> Wine
tab -> Registry Editor
)
Navigate to HKEY_CURRENT_USER\Control Panel\International
and start editing some of the values. A good overview is here. For example for UK settings, you can use:
"sLanguage"="ENG"
"Locale"="00000809" // this is for the keyboard layout, use the correct 8-digit number from here: https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-8.1-and-8/hh825682(v=win.10)
"LocaleName"="en-GB" // you can also find these codes in the above link
"sCurrency"="£"
"sDate"="/"
"sDecimal"="."
"sMonThousandSep"=","
"sList"=","
"sLongDate"="dd MMMM yyyy"
"sShortDate"="dd/MM/yyyy"
"sThousand"=","
"sTime"=":"
"sTimeFormat"="HH:mm:ss"
"sShortTime"="HH:mm"
"sYearMonth"="MMMM yyyy"
Back up your container: podman container commit -p msoffice2016 msoffice2016_container && podman save msoffice2016_container:latest | gzip > msoffice2016_container.tar.gz
(see here for the official documentation)
Then back up your container's /home folder by creating an archive (.tar.gz, .zip, whatever) of your complete ~/msoffice/msoffice2016
folder, or whatever location you chose (good that you set up a separate /home folder, right?).
to restore your backup:
Create a new empty folder ~/msoffice (delete the old one if needed) and extract the contents of your /home folder backup. Now you should have restored your old container /home folder in ~/msoffice/msoffice2016
.
Then locate your container backup (the msoffice2016_container.tar.gz) an restore the container by running the command podman load < msoffice2016_container.tar.gz && distrobox-create --name msoffice2016 --image msoffice2016_container:latest --home ~/msoffice/msoffice2016/
As both Office 2016 and Ubuntu 18.04 are "end of life", and will not receive any more security or feature updates, there is no need for them to access the Internet.
At this point I haven't found a good way to disable Internet access to the container. You'll need Internet for the initial set-up of the container. As a workaround you can use the --clone
flag to clone the existing container into a new one, while adding the --unshare-netns
flag. But I haven't tested it.