Two years ago, on a bright Summer day, I was sitting on my desk, fiddling with a Cisco Access Point that refused to work, when my boss burst into the door. We had a client with Office 2007 installed on Ubuntu, and it was refusing to do a certain task that she wanted, can’t really remember what. So we decided to simulate the error on our end, and then work on it.

While my team was doing that, I thought, “she does have Office 365, why not give it a try?”, after all there were 3 of us trying to simulate the error, one more guy looking at the same wouldn’t be necessary. So I decided to work on an alternative solution: Get her to use the most recent Office.

And what a pain that turned out to be. I saw screenshots online, but not a single tutorial, just glimpses and forum discussions going back and forth trying to find the same I was looking. But I eventually I got it to work, and now the client could finally use the most recent MS Office, if she wanted. She didn’t want to use it.

But why would you consider to run Office with Wine? Some Pros and cons. Pro:

  • Native run on Linux. Wine is not an emulator, so, for all purposes, it’s running as if it was native. Somewhat.
  • Well, it’s Microsoft Office, on Linux. That alone is cool, nice to show off.
  • Running .xlsm on Libreoffice isn’t the most fun of experiences, and in many businesses, that’s a necessity.
  • Have I mentioned how cool that is?

Con:

  • Outlook and Access just don’t work. But do you truly needed these two?
  • The performance isn’t quite there, and every so often you get some visual bugs interacting with menus.
  • No 64 bits, just 32, but unless you’re handling massive 2GB spreadsheets, you wouldn’t be able to tell anyway.
  • Not many people would actually find it to be cool.

Just to be clear, this is a standard fully updated Ubuntu 20.04 VM with nothing but the standard stuff. But you’re not forced to just use Ubuntu, just adapt according to your circumstances.

Alright, with that out of the way, let’s get to it.

First things first, you must download the installer. Here’s the link. The installer doesn't matter if 32 or 64 bits

You might want to an agent switcher on your browser. I used this extension for Firefox. Just switch to trick the browser to be recognized as a Windows PC.

Next, we’ll open up the terminal. We’ll begin to install all needed dependencies. This will, among other things, add the Wine repo to your system and all of what is or may be needed. It’s always good practice to read the code before you run it though.

sudo su - #This will sudo to root. If you don't want to do this, feel free to add a sudo before all the below commands.
dpkg --add-architecture i386
apt update
apt install gcc make perl
wget -qO- https://dl.winehq.org/wine-builds/winehq.key | apt-key add -
apt install software-properties-common
apt-add-repository "deb http://dl.winehq.org/wine-builds/ubuntu/ $(lsb_release -cs) main"
apt install --install-recommends winehq-stable
apt install winetricks winbind samba smbclient winetricks #Note: I actually had to apt install winbind a second time, but maybe was a connection issue on my end, but to just keep that in mind.

With this out of the way, we can logout from root, either with CTRL+D or with the command logout.

This is where the fun begins.

Now that we have all the dependencies worked out, we’ll be working on an unpriviliged user level. No need to escalate from this point on, and we want Office to just be installed with this user.

export WINEARCH=win32
mkdir ~/.msoffice
export WINEPREFIX=~/.msoffice 

This is definying the Windows architecture that will be used and where this Wine instance will be installed.

wineboot -i 

This will boot the wine instance, and will also ask for some a few things to be installed in this instance, as the screenshot below. Just accept and install all that’s requested.

Once that’s over, run this:

winetricks cmd corefonts msxml6 riched20 gdiplus

This will take about 20 to 30 minutes to be installed. Go grab yourself a snack, and wait patiently. You’re back? Still running? It ends eventually, don’t worry.

Ok, now that’s over, we can actually begin installing the Office. It’s rather simple. Again, without leaving the terminal:

wine path/to/the/installer/OfficeSetup.exe

Ok, now you should see the following:

If it passes this screen, it means we worked out all needed dependencies. If any missing(like above I mentioned winbind was missing) see the terminal output and where the error is, or what step was missed. Now you should see this: Yes, you’ll notice that the progress bar doesn’t display anything, but if you click on the system tray icon, you can see the progress there on the corner. If you see this, the installation of the office is over, but not quite yet for us I’m afraid. However you can close the window and CTRL+C on the terminal. Run the following:

cp -iv "${WINEPREFIX:-~/.wine}/drive_c/Program Files/Common Files/Microsoft Shared/ClickToRun/AppvIsvSubsystems32.dll" "${WINEPREFIX:-~/.wine}/drive_c/Program Files/Microsoft Office/root/Office16/AppvIsvSubsystems32.dll"
cp -iv "${WINEPREFIX:-~/.wine}/drive_c/Program Files/Common Files/Microsoft Shared/ClickToRun/C2R32.dll" "${WINEPREFIX:-~/.wine}/drive_c/Program Files/Microsoft Office/root/Office16/C2R32.dll"

This puts copies DLL files to the right place. Still one step missing. That’s right, it’s everyone’s favorite thing on Windows, regedit. We need to create 2 keys and 2 dwords, as below.

wine regedit

This will create the missing key. The path is as above. So HKCU/Software/Wine. Right click->New->Key Key name is “Direct2D”. Now inside this key, again right click->New->DWORD Value. The name and value is as below: One more key and DWORD missing. Again, like next screenshot:

You can now close regedit and never look at it again. What were they thinking when regedit was created I wonder.

Anyhow.

It’s over!

Now you can enjoy the most recent MS Office(2019 maybe? Who keeps track of this anyway?) on Linux.

Lastly, I must thank the Manjaro(and Arch, I guess) community for figuring this out and sharing each other’s progress on the forum. The links unfortunately are dead(I took note of them two years ago), but they may still work on the wayback machine.

Source:
https://forum.manjaro.org/t/office-365-using-wine-4-1/77418/8
https://forum.manjaro.org/t/is-there-any-way-to-run-office-365-with-word-pp-excel-etc-without-using-a-vm/55978/15
https://appdb.winehq.org/objectManager.php?sClass=version&iId=35527

This is the most recent version on the wine page:
https://appdb.winehq.org/objectManager.php?sClass=version&iId=36167

See you space cowboy.