This guide explains how to install Wine 6.0 on the Ubuntu 20.04 LTS focal fossa.
Wine is an open-source application that acts as a compatibility layer to run Windows programs in Unix-like operating systems such as Linux, FreeBSD, etc. It is capable of converting the Windows system calls to POSIX calls used by Linux systems. Hence enables the Windows programs executables (.exe) to run inside Linux systems. Although not all the programs would run inside Linux using Wine Or, even if it runs, it may not function correctly. However, with many improvements coming in Wine with every release, the majority of the programs would work fine. You can check out the Wine AppDB to find out which of the Windows programs runs fine in Wine.
Table of Contents
Install Wine in Ubuntu
Method 1:Â Install from Official Ubuntu Repository
The wine package is available in the Ubuntu official repository. However, it has the version of wine 5.0 as of writing this guide. If you install using this method, you would get the prior stable version.
However, to install Wine from official Ubuntu repository, open a terminal and tun below commands to install the 64-bit version.
sudo apt install wine64
While installing, make sure you install the required packages when prompted – mono and gecko.
After the installation is finished, you can run the below command to verify the installation.
wine –version
Now, you can check out how you can install Windows programs using Wine and uninstall Wine from Ubuntu.
Method 2: Install Wine from the official Wine website (winehq)
Step 1: Run the below command to add the i386 architecture that is required for this method.
sudo pkg --add-architecture i386
Step 2: Download the package signing key and add it to your system.
wget -O https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
Add the custom Wine official repository for Ubuntu 20.04 LTS focal fossa. If you are using any other Ubuntu versions, replace focal with respective release names (E.g. bionic, etc).
sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'
Refresh the package list using the below command.
sudo apt-get update
Finally, run the below command to install the latest Wine 6.0 stable in Ubuntu 20.04 LTS.
sudo apt-get install --install-recommends winehq-stable
Wait until the installation is complete. While installing, make sure you install the required packages – wine-mono and gecko when prompted. These are required for effective usage of Wine. Because many Windows programs depend on the .NET framework and they need the open-source replacement mono package.
After the installation is finished, you can check the wine installations by running the below command.
wine –version
Install programs using Wine 6.0
Installing any Windows executable with Wine 6.0 is easy after the install. All you need to do is run the .exe files using the wine installer. For example, in this guide, I have used the notepad++ .exe file for the demo.Â
Download the Notepad++ .exe installer from the official website. Right-click and open the .exe using Wine loader.Â
Then you can follow the onscreen instructions of the installer to install the program as you do in Windows.
After successful installation, you should get the application shortcut in the application menu.Â
Uninstall Wine from Ubuntu – proper way
Uninstalling the wine package properly is an event by itself. Because the typical apt remove doesn’t remove all the additional directories and files that are created by wine under your home directory. And worse, these directories take up a significant size as well.
So, to properly remove Wine from your Ubuntu 20.04 (or any version) – follow the below commands and steps carefully. I have not used the “rm -r” terminal commands because of safety. Instead, use the file manager and delete them one by one.
First, run the below command to remove the winehq-stable package.
sudo apt-get remove –purge winehq-stable
Then open the file manager and go to your home directory. Make sure you can view the hidden files using CTRL+H.
Then remove all the following directories and their contents as well by delete key.
Path | Which directory, files to remove |
~./ | .wine |
~./.config/menus/applications-merged/ | Any directory start with “wine” |
~./.local/share/applications/ | wine |
~./.local/share/desktop-directories/ | wine* |
~./.local/share/icons/ | All *.xpm files |
After you manually deleted the above items, run the following apt commands in the below order.
sudo apt update
sudo apt autoclean
sudo apt clean
sudo apt autoremove
If you want to remove the Wine software sources, you can open the Software Sources and manually remove the list.
Closing notes
I hope this guide helps you to install Wine 6.0 on Ubuntu 20.04. Also, the tutorial includes the configurations, installing a program, and installation methods as well. In general, the steps should be the same for all Ubuntu releases, however, some little tricks are required sometimes for other versions and releases. When you install Wine, try not to install, uninstall many times in a single installation. It may mess up certain packages. Also, remember that the Wine package takes a significant amount of disk space – so install and use it properly.