To run Microsoft Windows applications in Ubuntu Linux, Wine or CrossOver (paid version) is a good choice. And here’s how to install and use Wine in Ubuntu 22.04 LTS.
In this tutorial, you’ll see 2 ways to install Wine in Ubuntu. Choose either one that you prefer.
Install Wine from Ubuntu repository:
Ubuntu included Wine package in its own repository, though it’s old. User may simply press Ctrl+Alt+T on keyboard to open terminal and run command to install it:
sudo dpkg --add-architecture i386 && sudo apt install wine
Type user password (no asterisk feedback) and hit Enter to authentication for sudo.
After installed package run winecfg in terminal to generate configuration file. And, run command to make link the
sudo ln -s /usr/share/doc/wine/examples/wine.desktop /usr/share/applications/
Finally, you may right-click on an EXE file to run via “Wine Windows Program Loader” option:
Install Wine from its official repository:
The Wine developer team provides an official apt repository for Debian/Ubuntu based systems. By releasing v7.6, it added Ubuntu 22.04 support.
1. Install Wine key
The repository now has updated with new method to install the key to follow Debian policy, as apt-key is deprecated. However, it’s still ASCII-armored key so far.
Press Ctrl+Alt+T on keyboard to open terminal. When it opens, create the directory for storing the keys:
sudo mkdir -p /etc/apt/keyrings
Then, run the single command to download the key, dearmor, and move to “/etc/apt/keyrings” directory:
wget -O - https://dl.winehq.org/wine-builds/winehq.key | gpg --dearmor | sudo tee /etc/apt/keyrings/winehq-archive.key
Type user password and hit Enter if the command stuck with blinking cursor. And, it will output un-readable text as the picture shows:
2. Add Wine repository:
Next run the commands below one by one to download the repository setup file and move to “/etc/apt/sources.list.d” directory.
- Download the source file:
wget -nc https://dl.winehq.org/wine-builds/ubuntu/dists/$(lsb_release -sc)/winehq-$(lsb_release -sc).sources
- Move it into “/etc/apt/sources.list.d”:
sudo mv winehq-$(lsb_release -sc).sources /etc/apt/sources.list.d/
NOTE: This command is for Ubuntu only. “$(lsb_release -sc)” returns system’s code-name. For Linux Mint and other Ubuntu based system, replace it with jammy (22.04), focal (20.04) or bionic (18.04) depends on which Ubuntu edition your system is based on.
3. Update cache
Before installing any package from that repository, you need to refresh system cache by running command in terminal:
sudo apt update
4. Install Wine:
The Wine repository provides three Wine packages:
- winehq-stable – the stable version (v7.0 so far)
- winehq-devel – the latest development release.
- winehq-staging – the testing version with patches applied on top of the corresponding wine-devel
Select install one of the packages by running command below in terminal:
- To install the stable edition use command:
sudo apt install winehq-stable
- Install wine development release via:
sudo apt install winehq-devel
- Or install wine-staging via command:
sudo apt install winehq-staging
NOTE: It does not re-build old packages for new Linux systems.
winehq-stable so far is not available for Ubuntu 22.04, since the new LTS is released after wine stable 7.0. User may wait for the next stable release (v7.0.1 or v8.0).
After installation, right-click on your EXE file and start it via Wine program loader option. See if you app works with wine.
How to Remove Wine:
1. To remove the Wine package, simply open terminal and run commands:
sudo apt remove wine winehq-stable winehq-staging winehq-devel
There will be local configuration files and app data left under .wine and .local/share/applications. They are hidden folders, press Ctrl+H in file manager to toggle display and remove them as you want.
2. To remove the Wine repository, open terminal (Ctrl+Alt+T) and run command:
sudo rm /etc/apt/sources.list.d/winehq-*.sources
And remove the repository key via command:
sudo rm /etc/apt/keyrings/winehq-archive.key
Finally apply changes by running
sudo apt update to refresh system package cache.
I have followed the steps above in Ubuntu 22.04 to install wine.
It does not open but gives me an error message….
Couldn’t load XPCOM.
What do I do next?