If you’re a Linux or MacOS user you might depend on specific applications to get your work done. Whether that’s a personal project or a professional gig. Other times you might have the knowledge of a specific Windows app that you’ve been working with for several years but the main OS you’re running doesn’t have a good alternative. If that’s the case, then WINE might be the answer to your problem.
WINE is an open source project that began in 1993 with the intention of providing a compatibility layer in Unix-like systems to run Windows applications. Today, WINE also works as a main building block for other forked projects such as PlayOnLinux, Valve’s Proton and Lutris. All projects that are helping increase the overall percentage of desktop users migrating to Linux in recent years.
Today I’ll be showing you how WINE works and we’ll also be installing and running a Windows app (with no native support for Linux). Before we start, make sure your system is up to date by running:
sudo dnf update -y
Now let’s add the WINE repositories:
sudo dnf config-manager --add-repo https://dl.winehq.org/wine-builds/fedora/35/winehq.repo
WINE provides us with 3 different versions we can install: stable (‘winehq-stable’), development (‘winehq-devel’) and staging (‘winehq-staging’). Since this article is written for Fedora 35 and we clearly like living on the edge, let’s go and install winehq-devel. To do so run:
sudo dnf install -y winehq-devel
This will install WINE and all of its dependencies. To start WINE in a default environment we can run ‘winecfg‘ from the terminal. This will create a wine prefix in the ‘~/.wine’ directory. After you execute the command you will see a pop up window asking you to install Wine Mono which is needed for running .NET applications. Then select Install. Once wine-mono is installed, you will be prompted with yet another window for configuring WINE. This new window contains probably the most important option, that being “Windows Version”. Feel free to select whichever OS version you prefer. In my case that’s Windows 10.
You can run ‘ls -ltr ~/.wine’ to check its directory structure. We can now download our Windows native app and give it a go. Let’s try something relatively small such as Notepad++. Here’s a link to Notepad ++’s download page where you can select the latest x64 version to download. As the time of writing that’s version 8.4. With the .exe downloaded we can start the installation procedure. Do that with:
With the installation screen initiated, follow through with the steps and once you’re finished Notepad ++ should be running. At this point you can CRTL+C your terminal. This will obviously close your application but if you press the Windows Key to see GNOME’s Apps in your main OS you will see a direct access created for Notepad++.
What are WINEPREFIXES?
“Okay, we have our app installed now but.. what happens when I install a lot more? Isn’t that going to be messy?” Oh yes. Yes it will. A good way to deal with multiple apps that might have completely different dependencies is using WINEPREFIXES. By doing this you can have each app running in its own isolated environment. The way you can create a WINEPREFIX is by running:
In this case a hidden directory called ‘notepad++’ will be created in our HOME. This will allow you to have different Windows versions and use different winetricks (we will talk about them in a minute) for each one of them if you wish. Needless to say it will also be useful for troubleshooting purposes. To make sure that a specific environment will be used whenever you run wine commands, you have to prepend the WINEPREFIX variable and its desired value. If you wanted to install notepad++ in this new prefix we just created you’d run:
WINEPREFIX=~/.notepad++ wine Downloads/npp.8.4.Installer.x64.exe
Another important WINE variable that can be passed when running wine commands is WINARCH, with two possible values: win32 and win64. This is self explanatory. If you have a Windows app that’s 32bit then select WINEARCH=win32 . If you have a 64bits app use WINEARCH=win64.
Show Me Some Tricks
Let’s say we were installing a game with some dependencies such as ‘vcredist2019’ but our prefix doesn’t have it installed, that’s when winetricks come to our rescue. To install winetricks you can run these:
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks (fetch binary) chmod +x winetricks (give it execution privileges) sudo mv winetricks /usr/local/bin/ (add it you your PATH) WINEPREFIX=~/.notepad++ winetricks vcrun2015 (install vcrun with winetricks in the .notepad++ prefix)
Some useful winetricks to install are the aforementioned vcredist, dotnet, corefonts and directx9/11.
Using WINE can be daunting at first and still a bit messy later on when you know your way around better. Yet I believe that with some proper management of your applications you can easily have some fun with it and have a good experience running those applications that you don’t have an open source alternative for. At the end of the day, having official support from these companies would be beneficial but if that’s not the case in the foreseeable future, this could be a good alternative for what you need. Lastly, WINE contains a database with thousands of applications that have been tested in the past and are known to run better with specific (sometimes older) versions of WINE rather than on the latest.
To read more about WINE or even consider contributing to their project, please visit WINE’s official website.
I’m a passionate, communicative go-getter and highly motivated to build, maintain and improve a stable and effective IT infrastructure at different sized companies. My hearth is with open source, Linux, DevOps, Kubernetes and everything that is cloud native.