Run your Windows applications in Linux with Wine

Sometimes I need to try Windows applications for several reasons, one of them is that friends want some clarification about how a feature of a Windows application works and I try to help them using the application by myself first, installing it using Wine on my Linux PC… and here is what I do.

INTRODUCTION

  • Wine is a software capable of running Windows Applications on Linux and on other several POSIX-compliant operating systems (such as Mac OSX and BSD).
  • Winetricks is an application that let the user to easily configure and work around problems in Wine.
  • Wine prefix is a folder where Wine stores its configuration files and installed Windows programs. It’s a system profile used by Wine to execute the environment and the windows applications. The default wine prefix is usually the folder ‘.wine’ under your home folder.

Before starting, you must have the Wine and Winetricks programs installed on your linux distribution. Install them using your package manager, e.g. apt-get in Ubuntu and Debian Linux, pacman in Arch and Manjaro Linux or GUI package manager alternatives.

CREATION OF WINE PREFIXES

It’s possible to install and run Windows application that are made for 32 bit or 64 bit CPUs, it depends on your system architecture. In case you have a 64 bit linux system, it’s possible to create both 64 bit and 32 bit Wine prefixes. If you have a 32 bit system, it’s possible to create 32 bit prefixes only.

Open a Terminal/Console and give these commands:

  1. Clear your home folder from residual (dirty) wine prefixes:
    rm -fr ~/.wine
  2. Define two environment variables (WINEARCH and WINEPREFIX) used to set the system architecture and the containing folder for the Wine prefix. Then, configure the prefix. Here, we are creating two prefixes in the <userid> home:
    export WINEARCH=win32
    export WINEPREFIX="/home/<userid>/.wine32"
    winecfg
    
    export WINEARCH=win64
    export WINEPREFIX="/home/<userid>/.wine64"
    winecfg
    

    Each time you want to switch from one prefix to another, You have to set the environment variables with the related prefix values.
    After giving winecfg, a configuration window for the Wine prefix appears. Here you can change several prefix parameters, for example the Windows version that must be used:

    winecfg-shot

  3. Run winetricks then install any required dll or other library used to correctly run your Windows application:
    winetricks

    winetricks-shot

EXECUTING A WINDOW PROGRAM

To execute the Windows application (.exe file), give this command into the Terminal:

wine windows_program.exe

In case of errors, it’s necessary to investigate on the error massage or related log. Anyway, common errors are caused by missing libraries in the prefix folder. You can install them always using winetricks.

REFERENCES

To verify if a software is supported by Wine, you can check the Wine Application Database (AppDB) on the web page: https://appdb.winehq.org

Hoping this procedure can be useful for you dear friends and blog readers, have a nice day! /Saverio