Run windows application on Linux

Running windows application on ubuntu using WineHQ

To run windows applications on Linux or on macOS, we need an emulator or some kind of OS layer, which will help us in installing windows applications on other machines. For this article, we will be using WineHQ.

WineHQ is similar to a Virtual Machine or Simulator but works differently. To learn more about WineHQ visit their website.

The operating system which we will be going to use in today's article is Ubuntu 20.04.

Installing WineHQ on Ubuntu 20.04

open the Ubuntu terminal from the menu or by pressing CTRL + ALT + T.

The first step is going to check the system architecture.

let us check the 64-bit architecture first. It should respond with amd64.

dpkg --print-architecture

now, let us see if 32-bit architecture is installed or not. it should respond with i368.

dpkg --print-foreign-architectures

if you are unable to see the i368. run the following command to add it.

sudo dpkg --add-architecture i386

after adding make sure to re-check the 32-bit architecture using:

dpkg --print-foreign-architectures

Time to add the WineHQ Ubuntu repository

wget -nc https://dl.winehq.org/wine-builds/winehq.key
sudo mv winehq.key /usr/share/keyrings/winehq-archive.key

For different Ubuntu versions, there are different commands, I am listing commands for 20.04 & 22.04. For other distributions or versions check this link.

Check your ubuntu version using the following command in the terminal: lsb_release -a

  • Ubuntu 22.04
    wget -nc https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
    sudo mv winehq-jammy.sources /etc/apt/sources.list.d/
    
  • Ubuntu 20.04
  • Linux Mint 20.x
    wget -nc https://dl.winehq.org/wine-builds/ubuntu/dists/focal/winehq-focal.sources
    sudo mv winehq-focal.sources /etc/apt/sources.list.d/
    

After adding it to the repository install WineHQ:

sudo apt update
sudo apt install --install-recommends winehq-stable

Verify if the software is installed correctly

wine --version

Test the installation:

Simple clock application. Run the command in the terminal to verify the working of the WineHQ.

wine clock

Now, simply open any .exe file with WineHQ installation and enjoy your windows application on Ubuntu.

If you want to run the installation through the terminal then use:

wine sample.exe