How to Install Wine in Ubuntu 22.04 to Install & Run Windows Apps

Last updated: April 1, 2024 — 13 Comments

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 (Ubuntu 20.04 also supported).

In this tutorial, you’ll see 2 ways to install Wine in Ubuntu. Choose either one that you prefer.

Option 1: 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 .desktop file:

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:

Option 2: Install Latest Wine 9.x from its official repository:

The Wine developer team provides an official apt repository for Debian/Ubuntu based systems. Now the repository contains Wine 9.0.x stable, and 9.x Dev versions.

The repository so far supports Ubuntu 20.04, Ubuntu 22.04, and Ubuntu 23.10! It also works for Ubuntu 16.04 and Ubuntu 18.04, but old versions will be installed (Wine 5.0.3 for 16.04, and Wine 8.0.1 for 18.04).

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 -qO - https://dl.winehq.org/wine-builds/winehq.key | gpg --dearmor | sudo tee /etc/apt/keyrings/winehq-archive.key

Type user password (no visual feedback) when it asks. And, the command should output unreadable text as the screenshot below shows you:

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.

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

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) depends on which Ubuntu edition your system is based on.

If you don’t know which Ubuntu edition you system is based on, run cat /etc/os-release to tell through UBUNTU_CODENAME section.

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 (v9.0.x 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 your 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.

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee: https://ko-fi.com/ubuntuhandbook1

13 responses to How to Install Wine in Ubuntu 22.04 to Install & Run Windows Apps

  1. 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?

  2. Well I followed the second option and it was so cool and easy. I’m currently using Linux Lite 6.4 (Ubuntu Based distro).
    Thank you very much, won’t be stressing myself so much the next time I will be installing winehq.

  3. JeanMichelFelur April 15, 2023 at 5:33 pm

    Your command:

    wget -nc https://dl.winehq.org/wine-builds/ubuntu/dists/$(lsb_release -sc)/winehq-$(lsb_release -sc).sources

    does NOT work andproduces this message:

    zsh: parse error near `)’

    The correct command WORKS OK for Ubuntu 22.04 LTS:

    wget -nc https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources

    You should see something like this:

    Resolving dl.winehq.org (dl.winehq.org)… 146.75.94.217
    Connecting to dl.winehq.org (dl.winehq.org)|146.75.94.217|:443… connected.
    HTTP request sent, awaiting response… 200 OK
    Length: 163
    Saving to: ‘winehq-jammy.sources’

    winehq-jammy. 100% 163 –.-KB/s in 0s

    2023-04-15 11:26:25 (9.73 MB/s) – ‘winehq-jammy.sources’ saved [163/163]

  4. I installed WINE via the first method. Seemed to go fine. But when I get to the step about trying to run an executable file, WINE is nowhere to be found in any of my menus. I assumed the command before that step was meant to create a desktop icon, but it didn’t. Rebooted the machine and still nothing. Wine is installed on the system – I checked via two methods. But no idea how to launch it. Apparently from command line I can enter “wine” and then the name of a program, but I don’t have a program, i have an .exe file in my downloads folder that I want to run. Any idea where I can find Wine or why it’s not showing up?

    • Did you try to generate config file via command:

      winecfg

      Also, create the shortcut by linking the example file:

      sudo ln -s /usr/share/doc/wine/examples/wine.desktop /usr/share/applications/

      This worked in my case in Ubuntu 22.04.

      • Yes, I did both those things.

        I’ve decided to give up on WINE and try VirtualBox instead as it seems like WINE is pretty consistently riddled with problems. I’m not the only one who has this install issue and there don’t seem to be any easy fixes.

        Thanks anyway.

  5. apt-get check` failed, you may have broken packages. Aborting…
    Got all the way only to get this at the end. Any ideas?
    Ubuntu 22.04.2 LTS fully updated.

  6. There is no error. What I am seeing is that my version of the iso file does not include the partition table you show in your installation guide (even though my copy came from the “Official Ubuntu” site.) Do you have a recommended site to download the iso file from (My experience with PhoenixNAP was that is is VERY slow).
    Thank you

    • Ubuntu has download mirrors, just choose one near to you:

      https://launchpad.net/ubuntu/+cdmirrors

      For the ‘partition table’, if you meant the Ubuntu 22.04 installation guide. Then it could be something to do your disk. If it’s a brand new HDD or SSD, then the Ubuntu installer wizard should have a “New Partition Table” there to create it.

  7. This guide worked for me after I had an wine-staging installation working, and the I deleted the .wine folder inside my Home folder and couldn’t get any wine installation to work after installing wine-staging again after the .wine folder delete mishap.

    Followed the guide to completely remove my former wine-staging installation, the re-started my wine installation on my Linux Mint 21.2 system.

    Just had to alter the guide information with this line..

    wget -nc https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources

    instead of the line in this guide…

  8. Hi Ji m
    first off all apologize for my very bad english I’m a french guy :)
    so I want to thank you for your tuto it works fine !!
    but in the same time I can’t understand why the package included in ubuntu sotfware doesn’t run well
    I very often try linux and specially ubuntu since ten years ; it’s better and better but there’s always something wrong and to difficult to solve for ordinary user as me … it’s too bad
    this time it’s a good thing your tutorial was available
    thanks again

  9. First I tried to install wine (instructions from someone else), but failed. Then I tried out Virtualbox, running window systems like water in a river, but in the end I became aware of my disgust for Aunty M products. I tried your instructions, on Ubuntu 22.04. Fabulous., exactly how you described it. Thanks for the details.

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

*