How to Install Wine on Ubuntu 22.04 or 20.04

Wine, also known as WineHQ (Wine Is Not an Emulator), is a compatibility layer that enables users to run Windows applications on Unix-like operating systems such as Linux, macOS, and FreeBSD. Instead of emulating a complete Windows environment, Wine translates Windows application programming interface (API) calls into POSIX (Portable Operating System Interface) calls. This allows users to run Windows software on their preferred operating system without needing a virtual machine or a Windows license.

Here are some key differences and benefits of Wine:

  • Wine is not an emulator: Wine does not emulate a complete Windows environment. Instead, it translates Windows API calls into POSIX calls, making it a more lightweight and efficient solution.
  • Compatibility with various operating systems: Wine runs on various operating systems, including Linux, macOS, and FreeBSD, providing cross-platform compatibility for Windows applications.
  • Large database of compatible applications: Wine maintains a database of over 26,000 compatible Windows applications that run seamlessly on the compatibility layer, categorized by their level of compatibility, ranging from “Garbage” to “Platinum”.
  • Reduced need for virtual machines: Wine eliminates the need for a virtual machine or dual-boot setup to run Windows software on a non-Windows operating system, reducing the overhead and complexity of running two operating systems simultaneously.
  • Open-source and free: Wine is free to download and use, and its source code is available under the GNU Lesser General Public License (LGPL), allowing users to modify and distribute the software as they see fit.
  • Active development: Wine is under active development, with frequent updates and improvements to its compatibility and performance.

Now that you better understand Wine and its benefits, the following guide will demonstrate how to install Wine on Ubuntu 22.04 Jammy Jellyfish or Ubuntu 20.04 Focal Fossa using the official WineHQ repository for the latest stable, pre-release or development versions.

Step 1: Update Ubuntu

To ensure a smooth installation process of Wine, it is recommended to run a quick update of your system to ensure it is up-to-date. This will help avoid potential conflicts that may arise during the installation process.

sudo apt update && sudo apt upgrade

Step 2: Pre-installation Requirements

To facilitate the installation process of the software, it is necessary to install the following packages:

sudo apt install software-properties-common apt-transport-https curl

Even if you are unsure whether these packages are already installed on your system, running the command will not cause any harm. These packages are standard and are commonly found on nearly all Linux distributions, making them an essential part of any installation process.

Optional Step: Enable 32-bit Support

Enabling 32-bit architecture support is highly recommended to ensure compatibility with many games and Windows applications, as they may come in this format. Without this support, there may be limitations on what can be used with Wine.

To enable 32-bit architecture support, run the following command:

sudo dpkg --add-architecture i386

Most users, particularly those with lower-end systems, should enable this feature, as 32-bit games are more commonly found in this configuration. High-powered systems will not notice any impact from having these packages installed. It is a simple and effective way to ensure that your system is fully compatible with Wine and can run a wide range of applications seamlessly.

Step 3: Import WineHQ Repository

Before installing any versions of Wine from WineHQ, it is crucial to import the GPG key and WineHQ repository for your Ubuntu Linux system to ensure the authenticity of the Wine packages.

To import the required GPG key, run the following command:

curl -s https://dl.winehq.org/wine-builds/winehq.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/winehq.gpg > /dev/null

Next, import the WineHQ repository using the following command:

echo deb [signed-by=/usr/share/keyrings/winehq.gpg] http://dl.winehq.org/wine-builds/ubuntu/ $(lsb_release -cs) main | sudo tee /etc/apt/sources.list.d/winehq.list

After importing the GPG key and repository, run an APT update to reflect the new packages that have been imported:

sudo apt update

Step 4: Install Wine

Option 1: Install Wine stable release

The first method for installing Wine is to install the latest stable version from the WineHQ repository, which is often a better solution than using the Ubuntu repository version. This option provides a more updated version of Wine without being as cutting-edge as the development release from WineHQ.

To install the stable Wine release, run the following command:

sudo apt install --install-recommends winehq-stable

The –install-recommends option is used to install the recommended dependencies for WineHQ, ensuring it works optimally on your system.

Once the installation is complete, you can verify the version of Wine that you have installed by typing the following command:

wine --version

This will display the Wine version currently installed on your system.

Alternative – Install Wine from Ubuntu Repository

If you prefer another option for a stable Wine release, you can install the version from Ubuntu’s repositories. However, note that this version may be outdated compared to the latest stable release from WineHQ. Nevertheless, it is a reliable backup option.

To install Wine with the 64-bit version from the Ubuntu repository, use the following command:

sudo apt install wine64

For users who have enabled 32-bit support, it is recommended to install both 64-bit and 32-bit architectures as follows:

sudo apt install wine64 wine32

This command will install both the 64-bit and 32-bit versions of Wine.

Option 2: Install Wine staging release

The second method for installing Wine is to install the latest version from the staging branch. This option provides a beta or testing version just before the official release. It is ideal for users who prefer a newer version of Wine over the stable release but do not want to risk the instability of using the bleeding-edge development version.

To install the Wine staging release, run the following command:

sudo apt install --install-recommends winehq-staging

This will install the latest version of Wine from the staging branch, including any necessary dependencies.

Once the installation is complete, you can verify the version of Wine that you have installed by typing the following command:

wine --version

This will display the Wine version currently installed on your system.

Option 3: Install the Wine development version (nightly)

The third option for installing Wine is to install the latest version from the development branch. This option provides bleeding-edge software and may cause system instabilities. Therefore, it is recommended only for experienced users or developers who want to have a preview of upcoming features.

To install the Wine development release, run the following command:

sudo apt install --install-recommends winehq-devel

This will install the latest version of Wine from the development branch and any necessary dependencies.

Once the installation is complete, you can verify the version of Wine that you have installed by typing the following command:

wine --version

This will display the Wine version currently installed on your system. Following these steps, you can install the latest development version of Wine and experience its newest features.

Step 5: Finalize Wine Installation

Congratulations on successfully installing WineHQ on your Ubuntu system! It is time to finalize the installation by running the “winecfg” command in your terminal. This command installs the required environments for Wine to operate, including Mono, which is needed for running .NET applications on Linux.

To run the Wine configuration dialogue, type the following command in your terminal:

winecfg

Example output of Mono prompt installation for Wine on Ubuntu:

Press “Install” to proceed with the required installations. Once completed, the Wine configuration dialogue box will be displayed. In this section, you can configure various Wine settings.

By default, the settings should be sufficient for most cases. However, if you need to make any changes, remember that the default Windows version is set to Windows 7. You may want to adjust this to something more recent, such as Windows 10. Currently, Windows 11 is not supported yet, given it has just been released.

Example of WineCFG window on Ubuntu Linux:

Once you have finished making any desired changes, close the dialogue box.

There are also optional extras that you can install to make your Wine experience even better. For example, you can install winetricks, which provides extra libraries and applications to help Wine run Windows software more smoothly. You can install winetricks by running the following command in your terminal:

sudo apt install winetricks

With the winetricks package installed, you can use it to install additional Windows components that are not included with Wine. For example, to install the 32-bit version of the Microsoft fonts, use the following command:

winetricks allfonts

Example WineTricks UI on Ubuntu Linux:

Example of WineTricks application icon on Ubuntu Linux:

Additional Tips

Wine Example: Download and Install NotePad++

To run a Windows binary file using Wine, you can right-click on the file, select “Open With Other Application,” and select Wine from the list of applications.

For example, you want to download and install Notepad++ on your Ubuntu system using Wine. First, download the Notepad++ installation .exe file from the official website. Once the download is complete, navigate to the file’s directory.

To run the installation file using Wine, right-click on the .exe file, select “Open With Other Application,” and then select Wine from the list of applications.

Example:

wine install on ubuntu 22.04 or 20.04 lts - example launch notepad++ with wine installerPin
How to Install Wine on Ubuntu 22.04 or 20.04 6

To run Notepad++, click on the application icon, and the software will launch using Wine. With Wine, you can use this same process to run any other Windows applications on your Ubuntu system.

Examples:

wine install on ubuntu 22.04 or 20.04 lts - first example of installing notepad++ before handPin
How to Install Wine on Ubuntu 22.04 or 20.04 7
wine install on ubuntu 22.04 or 20.04 lts - second example of installing notepad++ afterwardsPin
How to Install Wine on Ubuntu 22.04 or 20.04 8
wine install on ubuntu 22.04 or 20.04 lts - notepad++ open and workingPin
How to Install Wine on Ubuntu 22.04 or 20.04 9

How to configure Wine as 32-bit

On Ubuntu, you can configure Wine to run both 32-bit and 64-bit Windows applications. By default, Wine is set up to run 64-bit applications. However, you can easily configure Wine to run 32-bit applications.

To set up Wine for 32-bit applications, you must set the WINEARCH environment variable to “win32” and the WINEPREFIX environment variable to a different directory than the default “~/.wine” directory.

Type the following command to set the WINEARCH environment variable to “win32”:

export WINEARCH=win32

Next, set the WINEPREFIX environment variable to a different directory than the default “~/.wine” directory. You can do this by typing the following command:

export WINEPREFIX=~/.wine32

This command creates a new Wine prefix directory called “.wine32” in your home directory.

winecfg

Finally, run the Wine configuration dialog box using the “winecfg” command to apply the changes you have made:

winecfg

This will open the Wine configuration window, where you can make any necessary changes to the settings for your 32-bit applications.

How to Run Wine From Terminal

Wine commands can be executed from the terminal on Ubuntu to provide more control over the software you are running. This section will cover some of the most commonly used Wine commands and explain their usage.

Syntax: wine

The most basic command for Wine is “wine.” This command allows you to run Windows applications from the terminal. To use this command, type “wine” followed by the path to the .exe file you wish to run.

Example:

wine /path/to/program.exe

Syntax: winecfg

The “winecfg” command allows you to configure various settings for Wine, such as the Windows version, audio settings, and graphics settings. This command opens the Wine configuration dialogue box, where you can change the settings.

Example:

winecfg

Syntax: regedit

The “regedit” command allows you to access the Wine registry editor. The registry editor is a database that stores configuration settings for Wine and Windows applications.

Example:

wine regedit

Syntax: winetricks

The “winetricks” command is used to install additional components and libraries not included with Wine. This command lists available components and lets you choose which ones to install.

Example:

winetricks allfonts

Syntax: winepath

The “winepath” command converts Windows-style paths to Unix-style paths and vice versa. This command is useful for scripts that work with Windows and Unix paths.

Example:

winepath -w /unix/path

This command will convert the Unix-style path to a Windows-style path.

Syntax: wineserver

The “wineserver” command manages the Wine server, which handles communication between Windows applications and Linux. This command is rarely used but can be useful for debugging or troubleshooting.

Example:

wineserver -k

This command will kill the Wine server, which can help resolve some issues with Wine.

By utilizing these Wine commands, you can have more control over your Windows applications and improve your experience running them on Ubuntu.

How to Update Wine

To update Wine to the latest version from WineHQ, you need to run the following command in the terminal:

sudo apt upgrade && sudo apt update

How to Remove (Uninstall) Wine

Depending on which version of Wine you have installed, you can use one of the following commands to remove it.

Removing WineHQ Stable Release:

sudo apt remove winehq-stable

Removing WineHQ Staging Release:

sudo apt remove winehq-staging

Removing WineHQ Development Release:

sudo apt remove winehq-devel

After removing the version of Wine that you no longer need, you can delete the repository file using the following command:

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

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

sudo rm /usr/share/keyrings/winehq.gpg

Remove Wine (Ubuntu Repository Versions)

If you installed Wine from the default Ubuntu repository, you could use the following command to remove it:

sudo apt remove wine32 wine64

Conclusion

In conclusion, installing Wine (WineHQ) on Ubuntu is a crucial step for users who wish to run Windows applications on their Linux-based systems. The Wine project has consistently evolved and improved its compatibility with an extensive array of Windows applications, making it a valuable tool for Ubuntu users. To ensure a successful installation process and optimal performance, following the official guidelines and documentation provided by the WineHQ and Ubuntu communities is essential. Additionally, staying updated with the latest version of Wine will enable users to benefit from the most recent enhancements and compatibility improvements.

Additional Resources and Links

  • WineHQ Official Website: The website for the Wine project, where you can find the latest releases, news, and wine-related updates. WineHQ
  • WineHQ Documentation: Comprehensive documentation on Wine’s features, installation, usage, and configuration. A must-read for any Wine user. Wine User’s Guide
  • Ubuntu Wiki – Wine: The official Ubuntu Wiki page on Wine offers guidelines for installation, configuration, and troubleshooting specific to Ubuntu users. Ubuntu Wiki – Wine
  • WineHQ Forums: A valuable community-driven platform where you can find assistance, ask questions, and share your knowledge with fellow Wine users. WineHQ Forums
  • WineHQ AppDB: A comprehensive database of Windows applications and their compatibility with Wine, maintained by the Wine community. This resource can help you determine if your desired application is supported by Wine. Wine Application Database (AppDB)
  • WineHQ Bugzilla: The official bug-tracking platform for Wine, where you can report issues, track bug fixes, and view the progress of the Wine development team. WineHQ Bugzilla

Share to...