How to Install Wine on Ubuntu 22.04 LTS

Wine Windows Emulator on Ubuntu 22.04

When Linux was originally made public, it lacked many useful applications that the major competitor Windows successfully supported. Linux thus created a compatibility layer, called Wine, which was used to run the Windows applications on Linux itself. Initially, Wine could only run a few Windows applications but now it can support thousands of them; making it a compelling Linux application. Its installation, however, is very simple!

This article describes installing Wine on an Ubuntu 22.04 system. We have described the installation only through the command line.

Installing Wine On Ubuntu

Step1: Check if you have an Ubuntu 32-bit or 64-bit system

There are different versions of Wine available for 32-bit and 64-bit flavors of Ubuntu. In order to check which version you are using so that you can install the appropriate version of wine, please follow these steps:

Open the Terminal either through Ubuntu Dash or the Ctrl+Alt+T shortcut.

Use the following command to fetch CPU details from the files sysfs and /proc/cpuinfo:

$ lscpu

This command will display the following output:

Ubuntu CPU Architecture

The CPU op-mode(s) entry tells you about the flavor of Ubuntu you are running on your system; 32-bit means you are running a 32-bit Linux OS, 32-bit, 64-bit signifies that you are running a 64-bit OS.

Step2: Installing Wine from a Standard Ubuntu Repository (recommended)

We recommend that you install Wine on your system through the standard Ubuntu repository, as this way you can have a more stable version on your system.

Run the following command in the Terminal as a root user in order to install Wine on a 64-bit version of Ubuntu:

$ sudo apt install wine64

Installing Wine Windows Emulator on Ubuntu 22.04

Please enter y when you are prompted with a y/n option for installation. After that, the Wine application will be installed and ready for use.

For a 32-bit Ubuntu system, you can use the following command:

$ sudo apt install wine32

You can verify the version of Wine through the following command:

$ wine --version

Alternative: Installing Wine from the WineHQ Repository

The WineHQ repository has a set of standard Wine packages that you can download and install on your system. Please follow these steps to do so:

Run the following command in the Terminal for adding i386 architecture before installing a 64-bit version of Wine:

$ sudo dpkg --add-architecture i386

Add i386 architecture

Run the following commands in order to add the WineHQ signing key:

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

Download and Install the WineHQ repository key

Tip: You can copy this command from this tutorial instead of typing it in the Terminal. Select and copy this command from here, right-click in the Terminal prompt and then select Paste from the menu.

Now run the following command in order to add the WineHQ repository:

$ wget -nc https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
$ sudo mv winehq-jammy.sources /etc/apt/sources.list.d/

Add the WineHQ Repository

Then update the Ubuntu package lists with the command:

apt update

Update package lists

Here you have two options about which release of Wine you want to install; the stable version or the development version.

  • WineHQ Stable: This is the most recent and stable release of Wine available. Use the following command to install this version:
sudo apt install --install-recommends winehq-stable

Please enter Y when prompted with a choice of y/n for installation. After that, the stable version of Wine will be installed on your system.

At the time of writing this guide, there is no stable version of Wine available yet, so executing the command will result in the error message:

E: Unable to locate package winehq-stable

For this reason, I will install the Development branch now. But generally, I recommend using the stable branch.

  • WineHQ Development: This is the most recent version of Wine but it might not be very stable. As a developer, you might be more interested in installing this version.
sudo apt-get install --install-recommends winehq-devel

Install Wine Development version

Please enter Y when prompted with a choice of y/n for installation. After that, the development version of Wine will be installed on your system.

In order to verify installation and check which version is installed on your system, run the following command:

$ wine --version

Wine version 7 installed

Uninstalling Wine From Your System

Please enter the following command in your Ubuntu Terminal in order to uninstall Wine from your system:

$ sudo apt-get purge winehq-stable

You will also need to remove the following folders manually:

~/.config/wine/ -r

$HOME/.wine

$HOME/.config/menus/applications-merged/wine*

$HOME/.local/share/applications/wine

/.local/share/desktop-directories/wine*

/.local/share/icons/????_*.xpm

The installation will now be completely removed from your system.

Conclusion

By following the steps described in this tutorial, you will be successfully able to install the useful application Wine to your system. It might be the latest release from the Ubuntu Repository or the stable/development version from the WineHQ repositories. We have also described the uninstallation process so you can easily remove Wine from your system, be it for new installation or complete removal.

There is also an alternative Wine-based installer available for installing Windows software on Linux named PlayOnLinux. A tutorial for PlayOnLinux can be found here.