Install WineHQ on Ubuntu 22.04

This guide intends to teach you How To Install WineHQ (Wine) on Ubuntu 22.04 LTS from the Command Line.

Wine INot an Emulator (Wine) is a compatibility layer for Windows executable files in the Linux OS. It takes the Windows system calls and converts them to POSIX system calls readable by Linux programs.

Wine also contains a tool called “Winelib” that we use to compile Windows-supported applications and programs to port them to Unix-like systems.”

In simple terms, Wine is a collection of Linux libraries that enable many Windows applications to run on Linux distributions with varying degrees of success and stability.

Steps To Install WineHQ on Ubuntu 22.04 from Terminal

To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with Ubuntu 22.04.

Step 1 – Enable 32-bit architecture on Ubuntu 22.04

First of all, you need to check the installed architectures. To do this, run the command below:

sudo dpkg --print-architecture

You should get the following output:

Output
amd64

Then, check if 32-bit architecture is installed on your server with the command below:

sudo dpkg --print-foreign-architectures

You should get the following output:

Output
i386

Note: If “i386” is not displayed, execute the following command:

sudo dpkg --add-architecture i386

Next, recheck again with the command below:

sudo dpkg --print-foreign-architectures

Step 2 – Download and Add the WineHQ Repository Key

At this point, you need to add the WineHQ repository key on Ubuntu 22.04. To do this, run the commands below:

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

Then, use the command below to download the WineHQ sources file:

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

Update your local package index:

sudo apt update

Important Note: If you get this warning W: GPG error: https://dl.winehq.org/ …, you should edit the winehq-<distro>.sources file and replace /usr/share/keyrings/ to /etc/apt/keyrings/.

In this case, use the command below: 

sudo sed -i s@/usr/share/keyrings/@/etc/apt/keyrings/@ /etc/apt/sources.list.d/winehq-jammy.sources

Now you can proceed to the following step to install Wine on Ubuntu 22.04.

Step 3 – Install Wine on Ubuntu 22.04

At this point, you can use the commands below to install WineHQ on your server.

1.WineHQ Stable branch:

sudo apt install --install-recommends winehq-stable

2.WineHQ Development branch:

sudo apt install --install-recommends winehq-devel

3.WineHQ Staging branch:

sudo apt install --install-recommends winehq-staging

It is recommended to install the stable branch. When your installation is completed, verify it by checking its version:

wine --version
Output
wine-8.0.2

Step 4 – Uninstall or Remove Wine from Ubuntu 22.04 LTS

If you don’t use Wine anymore you can easily remove it from your server. To do this run the following command:

sudo apt autoremove --install-recommends winehq-stable --purge

Note: If you use Wine Development or Wine Staging, replace the winehq-stable with either winehq-devel or with winehq-staging.

For complete removal, delete the repository file:

sudo rm /etc/apt/sources.list.d/winehq*

If you have removed the WineHQ repository, it is recommended to remove the GPG key:

sudo rm /usr/share/keyrings/winehq*

Conclusion

At this point, you have learned to Install WineHQ (Wine) on Ubuntu 22.04 LTS. You can easily add the Wine repository to your server and install the stable version on your Ubuntu 22.04 LTS. Hope you enjoy it.

You may like these articles:

Install and Configure Fail2ban on Ubuntu 22.04

Install chkrootkit on Ubuntu 22.04

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

POPULAR TAGS

Most Popular