Project, Research

Installing Windows Software on Ubuntu with PlayOnLinux 1

A while back I switched over my desktop PC operating system to Linux to install and run neural networks. At the time, I wasn’t ready to ditch Windows completely because of MS Office and my Steam games so I started by dual-booting Unbuntu 18.04 and Windows 10.

My enthusiasm at finally being a real computer nerd capable of snarkily telling others “Oh…I don’t use Windows at home anymore…”

It didn’t take long to get sick of restarting my computer just to use a desktop version of MS Office, so I decided to install a Windows 10 Virtual Machine. I also took that time to install Windows XP so I could revisit a beloved childhood game that is so old and obscure it’s practically impossible to find or play. Because reasons.

While the VM works, I dislike allocating half of my RAM just so I can use Skype and Outlook in a format that isn’t atrocious (I’m looking at you MS Office web apps… gross).

My review for literally every MS Office 365 web app ^

I finally got fed up and decided to see if there was any other options available, which led me to the discovery of PlayOnLinux. This is a platform that allows those with Linux OS’s to install non-Linux software. How exciting!

I don’t know why my friends don’t believe me when I tell them how much fun these tech projects are for me. THIS IS ENJOYABLE!!!

During this journey I opted to install a program called Stacer (CCleaner alternative for Linux) to help me monitor all these programs I’m installing and find ways to optimize my system. Below are the commands I ran to update & upgrade, and install Stacer, wine, and playonlinux.

sudo apt-get update && sudo apt-get upgrade -y
sudo add-apt-repository ppa:oguzhaninan/stacer -y
sudo apt-get update
sudo apt-get install stacer -y
sudo apt install wine-stable
wget -q "http://deb.playonlinux.com/public.gpg" -O- | sudo apt-key add -
sudo wget http://deb.playonlinux.com/playonlinux_precise.list -O /etc/apt/sources.list.d/playonlinux.list
sudo apt update
sudo apt install playonlinux

After starting the software, I tried to install Office 2016 from and got an error telling me to install xterm and winbind.

sudo apt-get install xterm
sudo apt-get install playonlinux samba winbind
sudo apt update

After addressing those errors, I needed to install winetricks by making a shell script.

# Create and switch to a temporary directory writeable by current user. See:
#   https://www.tldp.org/LDP/abs/html/subshells.html
cd "$(mktemp -d)"

# Use a BASH "here document" to create an updater shell script file.
# See:
#   https://www.tldp.org/LDP/abs/html/here-docs.html
# >  outputs stdout to a file, overwriting any pre-existing file
# << takes input, directly from the script itself, till the second '_EOF_SCRIPT' marker, as stdin
# the cat command hooks these 2 streams up (stdin and stdout)
###### create update_winetricks START ########
cat > update_winetricks <<_EOF_SCRIPT
#!/bin/sh

# Create and switch to a temporary directory writeable by current user. See:
#   https://www.tldp.org/LDP/abs/html/subshells.html
cd "$(mktemp -d)"

# Download the latest winetricks script (master="latest version") from Github.
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks

# Mark the winetricks script (we've just downloaded) as executable. See:
#   https://www.tldp.org/LDP/GNU-Linux-Tools-Summary/html/x9543.htm
chmod +x winetricks

# Move the winetricks script to a location which will be in the standard user PATH. See:
#   https://www.tldp.org/LDP/abs/html/internalvariables.html
sudo mv winetricks /usr/bin

# Download the latest winetricks BASH completion script (master="latest version") from Github.
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks.bash-completion

# Move the winetricks BASH completion script to a standard location for BASH completion modules. See:
#   https://www.tldp.org/LDP/abs/html/tabexpansion.html
sudo mv winetricks.bash-completion /usr/share/bash-completion/completions/winetricks
_EOF_SCRIPT 
###### create update_winetricks FINISH ########

# Mark the update_winetricks script (we've just written out) as executable. See:
#   https://www.tldp.org/LDP/GNU-Linux-Tools-Summary/html/x9543.htm
chmod +x update_winetricks

# We must escalate privileges to root, as regular Linux users do not have write access to '/usr/bin'.
sudo mv update_winetricks /usr/bin/

I copy and pasted the above into a text file and saved as “winetricks” file on my desktop. Next I gave permission to the script to run and then ran it in the terminal.

chmod +x /home/catjitsu/Desktop/winetricks
/home/catjitsu/Desktop/winetricks

Now that Iive got winetricks, the installation of Microsoft Office 2016 was under way! I downloaded the 32-bit setup file and clicked through the prompts until Office began to install…………………and I got an error on install.

To be fair, everything was going WAY too well

A google later and I found an updated installer script to try from user GlasierXplor posted in August 2019 along with manual installation instructions if this fails.

There is *very* little chance this is going to work

Aaaaaaaaaaaaand it failed. More googling ensued, which led me to a forum where at least one person DID successfully get this working. And another user referred to wineHQ instructions along with an entire list of tested Ubuntu 18.04 applications.

WINEARCH=win32
export WINEPREFIX=~/.msoffice
wineboot -i
winetricks winecfg

So errors galore occurred, and after some googling and speed reading I discovered I’m using an outdated version of wine. So time to install it directly from their website instructions!

wget -nc https://dl.winehq.org/wine-builds/winehq.key
sudo apt-key add winehq.key
sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main'
sudo apt update
sudo apt install --install-recommends winehq-stable
wineboot -i

And this time wineboot seemed to start…….but turned into a big cluster of errors fast. 0_0

I decided now that I knew the wrong wine version was being used, I should go back to PlayOnLinux to see if I could switch the version used there and try the installer again.

I clicked the “Configure” button, selected the “Office2016” option from the previous installation attempt, and selected the “+” button next to “Wine Version”. It popped up with an entire list of versions, so I chose to install 4.15 to match the version tested on winehq.

Maybe this??? Is this what learning is?

After blindly clicking, I decided to just start fresh, only this time I would fix this other nagging issue where “mono installer” has not been installed. And if the advice to install .NET doesn’t work, I’ll use the actual Mono installation guide (like I probably should have been from the start).

sudo apt-get install winetricks
winetricks dotnet45

A STARTLING AMOUNT OF TEXT IS FLYING THROUGH THE COMMAND PROMPT AND I AM DOING MY BEST TO THINK THIS IS A GOOD THING.

So….okay? I have no idea what just happened. Time to click back on that MS Office 2016 script and see what happens this time! I decided to use the “overwrite” instead of “erase” the previous virtual drive, and I didn’t get the “mono installer” prompt error so at least I know something is different this go around. ¯\_(ツ)_/¯

30 minutes until Indian food takeout arrives and my wife saves me from myself. Let’s see how many more times I fail in that timeframe! ¯\_(ツ)_/¯

While it installs, I decided to put my Stacer program to use and look up the system processes running to see where wine is running to check if it’s still using an older version.

OMG IT REACHED 64%–IT USUALLY ERRORS BY N–……..

Well that’s all for me today! Time to eat Indian food and think about why I ever decide to do “easy side projects” on my time off.

ALSO I GOT MARRIED A FEW WEEKS AGO!!! 🙂 Part of the reason I dropped off from the blog for a while. I actually have a huge backlog of projects I worked on, but haven’t cleaned up the content to share… Perhaps I will find time to do that instead of just dive into new adventures like this. ¯\_(ツ)_/¯

Leave a Reply