Posted in Technology

How to run Windows applications on Linux PC

Microsoft Windows operating system has its advantages: one of them is the vast selection of open source and commercial applications. Linux fans may argue that there are even more apps for Linux because of servers and Android (which is built on Linux). Either way, someone considering moving to Linux PC may have second thoughts because an important app doesn’t run on Linux. It is possible, and here is our how-to guide for running Windows software on a Linux computer.

This guide was tested on Debian 10 Buster, KDE Plasma desktop, and Wine 4.0, but the solution should work on a wide range of Linux configurations.

First step: Install Wine on your Linux PC

Wine is a software layer for Linux that allows applications developed for Windows to run on Ubuntu, Fedora, Debian, Suse, and Android as well. First, you have to install Wine on your Linux PC, then install Windows apps you want, and then determine how you want to start each Windows app.

Let’s start. Even if you have a 64-bit architecture computer, you must run Wine as an i386 program. If you are not sure about the architecture, check it:
dpkg --print-architecture

If the response is amd64, you have to install support for i386. Run the following command to add the architecture:
dpkg --add-architecture i386
apt update

Install Wine on a computer running 64-bit architecture (this will take about 1 GB of space):
apt install wine

A Debian 10 system should install everything required, but if your system is missing modules, install these as well:
wine32, wine64, libwine, libwine:i386, fonts-wine

Install Wine on a 32-bit architecture system:
apt install wine
…and if required: wine32, libwine, fonts-wine

Test if the installation was successful. Run:
wine
If the response is a list of command options on how to use Wine, things are looking good at this stage.

Second step: Install a Windows application

Before installing a Windows application, it is a good idea to check its compatibility. Wine web site has a database of hundreds of apps and their compatibility with the software.

If it looks like the app might run with Wine, download the Windows installation package for it.

If you have been operating your Linux system as root until now, this is the perfect moment to sign in as a normal user. That’s what Wine wants from here on.

To install a Windows program, run its installation package (.exe or .msi) like so:
wine name-of-windows-app-installation-package.exe
For instance, I installed password safe:
wine pwsafe-3.52.0.exe

wine windows directories on linux pc
Wine directory structure fro Windows (user and host names removed from the screen shot).

Third step: Run the Windows app

After successful installation, the C: drive for Windows (drive_c) can be found in:
/home/username/.wine/

The Windows app you installed is in:
.wine/drive_c/Program Files/
or
.wine/drive_c/Program Files (x86)/

If you walk down the directory path with cd command, try:
cd “Program Files”
or
cd ‘Program Files’

For example, the entire path for Password Safe installed by username is:
/home/username/.wine/drive_c/'Program Files (x86)'/'Password Safe'/pwsafe.exe

Run the Windows app (when you are in the directory mentioned above):
wine pwsafe.exe

If you see an error message something like this:
0009:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
Set the variable like so:
DISPLAY=:0
Test:
echo $DISPLAY
The response should be:
:0

Retry to run: wine windows-application-name.exe

Fourth step: Make it easier to run the Windows app

Now that your Windows app runs, you may want to make it easier to launch it. There are a gazillion ways to do it in Linux, but the following method is a good start that works universally.

Create a globally executable command for the Windows app in
/usr/local/bin/
Create a new file in the directory using an editor. Name the file, for instance, windapp, and insert one line in it:
wine /home/username/.wine/c_drive/'Program Files (x86)'/'Application Dir'/windows-application-name.exe

For instance, for Password Safe, the content of the file is:
wine /home/username/.wine/c_drive/'Program Files (x86)'/'Password Safe'/pwsafe.exe

Now, you should be able to run the Windows app simply by typing the file name (for instance, windapp) you created in /usr/local/bin/. If it doesn’t run, you have to modify access rights for the file so that it is executable.

So far, so good, but running the Windows app requires you to keep the Terminal window open. If you close the Terminal window, the app will close, too. One more tweak: launch the Windows app using nohup command so that the Terminal window is not tied to the app:
nohup windapp > /dev/null &

Leave a Reply

Your email address will not be published. Required fields are marked *


CAPTCHA Image