Debian

How to Setup Wine on Debian 12

Debian 12 is a Linux operating system that does not allow users to run Windows applications on their computers. Keeping the increasing demand for Windows applications, the developers have created an application called Wine. The Wine is a compatibility layer that provides you the freedom to download and install Windows applications and run them on your Linux desktop.

In this guide, you will learn:

How to Install Wine on Debian 12

You can install Wine on Debian 12 using the following steps:

Step 1: Add the Architecture

First, you must add 32-Bit system architecture in case you are using Debian 12 amd64 version on your computer. The reason is it allows you to run a 32-Bit Windows application on a 64-Bit Debian system. You can add i386 architecture on Debian from the following command:

sudo dpkg --add-architecture i386

Step 2: Create a keyrings Directory on Debian

Then create a directory with the name keyrings in the apt repository directory as it is useful for storing GPG keys of Debian developers. You can use the following mkdir command to create keyrings directory on Debian system:

sudo mkdir -pm755 /etc/apt/keyrings

In the above command, -p flag creates parent directories if they don’t exist, while -m755 flag provides users full access to the directory.

Step 3: Download GPG Key

Now download the GPG Key on Debian 12 using the following command since it is required to authenticate the Wine repository:

sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key

Step 4: Add Wine Repository to Debian 12

After adding the GPG Key, use the following command to add Wine repository to Debian 12:

sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/debian/dists/bookworm/winehq-bookworm.sources

Step 5: Update Debian Repository

Now, you must update the packages on Debian 12 using the following command to ensure the Wine repository is successfully added to the system without an error or warning:

sudo apt update

Step 6: Install Wine on Debian 12

Once the repository is updated, you can use the command given below to install Wine Stable release on Debian 12:

sudo apt install --install-recommends winehq-stable -y

Step 7: Check Wine Version on Debian 12

To confirm Wine is successfully installed on Debian 12, you can use the following command:

wine --version

Note: You can also install Wine on Debian 12 from the apt repository using the following command:

sudo apt install wine -y

However, it installs the older version on Debian which is not recommended for the users. You should stick with installing the updated and stable version of Wine on Debian 12 using the above-mentioned steps.

How to Use Wine on Debian 12

To use Wine on Debian 12 for running Windows application, follow the below-given steps:

Step 1: Download a Windows Application on Debian 12

First, you have to download a Windows application on your Debian system either you can download directly or use the wget command to download it from the terminal.

Here, I have downloaded the widely used SSH client for Windows called PuTTY on Debian 12 using the wget command given below:

wget https://the.earth.li/~sgtatham/putty/latest/w32/putty.exe

Step 2: Install Application Using Wine

To install the Windows application using Wine, you can use the wine command followed by the application name you just downloaded on Debian 12:

wine application_name.exe

Click on the Install button to perform the installation of Windows application on a Debian system using Wine:

Note: If you have downloaded a Windows application with the .msi file extension, you can use the following command to following command to install it:

wine msiexec /i application_name.msi

Step 3: Run Windows Application Using Wine

If everything goes well, use the wine command again with the application name to run it on your Debian system:

wine application_name

How to Uninstall a Windows Application from Wine on Debian 12

If you have installed a Windows application from Wine on Debian 12, use the following steps to remove it in case you don’t need it anymore:

Step 1: Open Wine Uninstaller

First, open Wine uninstaller from the terminal by using the following command:

wine uninstaller

Step 2: Uninstall Application from Wine

Then choose the application you want to remove and select the Modify/Remove button:

Finally, click the Install button again and the program will be uninstalled from the Wine on Debian 12:

Step 3: Verify the Uninstallation on Wine

You can verify whether the program is successfully uninstalled from Wine by running the following command again:

wine uninstaller

How to Remove Wine from Debian 12

If you want to completely remove Wine from Debian 12, you can use the following command:

sudo apt --purge autoremove winehq-stable -y

How to Remove Wine Repository from Debian 12

To remove Wine repository from Debian 12, you can use the following steps:

Step 1: First navigate to source repository directory on Debian 12 using the following command:

cd /etc/apt/sources.list.d

Step 2: Then find the Wine repository added to Debian using the ls command given below:

ls

Step 3: Now you can remove the repository from Debian using the rm command given below:

sudo rm winehq-bookworm.sources

 

Conclusion

Wine is an effective tool that allows you to run Windows applications on Linux systems. You can install Wine on Debian 12 by downloading the GPG Key, adding the repository, updating the packages list and then installing it through apt command. After the installation, you can download a Windows application on Debian, and install it through Wine. Then run the file using wine command with the application name on your Debian system. The step-by-step guide to install Wine on Debian 12, install and remove applications from Wine is provided in the above-section of this guide. You will also find a guide on how to remove Wine and its repository from the system.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.