How to Install Wine on Ubuntu 24.04, 22.04 or 20.04

Wine, or WineHQ, is a crucial compatibility layer that allows users to efficiently run Windows applications on Unix-like operating systems, including Linux. Below are some of the key features and benefits:

  • Not an Emulator: Unlike traditional emulators, Wine translates Windows API calls into POSIX calls without emulating a complete Windows environment, resulting in a lightweight and efficient solution.
  • Cross-Platform Compatibility: Wine supports Linux, macOS, and FreeBSD, ensuring Windows applications are accessible on various operating systems.
  • Extensive Application Database: Wine supports over 26,000 Windows applications, each categorized by compatibility levels ranging from “Garbage” to “Platinum.”
  • Eliminates Virtual Machines: Users can run Windows software without relying on virtual machines or dual-boot setups, simplifying the user experience and reducing system overhead.
  • Open Source and Free: Available under the GNU Lesser General Public License (LGPL), Wine is free and open source, promoting user modification and distribution.
  • Actively Developed: With ongoing development, Wine consistently receives updates and enhancements to improve compatibility and performance.

With these features, Wine stands out as a valuable tool for those needing to run Windows applications on Ubuntu without the hassle of operating dual systems or virtual machines. Let’s move on installing Wine by utilizing the WineHQ APT repository for the latest stable, staging, or development version.

Update Ubuntu Before Wine Installation

Before installing Wine, update your system to prevent potential conflicts during installation:

sudo apt update && sudo apt upgrade

Wine Pre-installation Steps

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

Enable 32-bit Support for Wine (Optional)

Enable 32-bit architecture support to make Wine compatible with many games and Windows applications. Lack of this support may limit Wine’s usability.

To activate 32-bit architecture support, execute the command below:

sudo dpkg --add-architecture i386

Especially for lower-end systems, users should enable this feature since many 32-bit games require it. High-powered systems won’t experience any negative impact from installing these packages, ensuring complete compatibility with Wine and smooth running of various applications.

Import WineHQ APT 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, execute an APT update to acknowledge the newly imported packages:

sudo apt update

Proceed with Wine Installation

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

Note: Utilize the –install-recommends option to install WineHQ’s recommended dependencies, optimizing its performance 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 the Ubuntu Repository

Consider installing the version available in Ubuntu’s repositories for a stable Wine release. Although possibly outdated, this version is a dependable alternative.

To install the 64-bit Wine version from the Ubuntu repository, enter the command below:

sudo apt install wine64

If you’ve enabled 32-bit support, install both 64-bit and 32-bit architectures as outlined:

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 Wine devel (nightly dev version)

Consider installing Wine from the development branch to access the most recent features. This version, while cutting-edge, might be unstable. Hence, only experienced users or developers should use it.

To install the Wine development release, input the command below:

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.

Finalize Wine Installation

After successfully installing WineHQ on your Ubuntu system, finalize the installation by running the “winecfg” command. This command sets up the necessary environments for Wine, including Mono, for running .NET applications on Linux.

To initiate the Wine configuration dialogue, enter the command below:

winecfg

Click “Install” to initiate the necessary installations. Upon completion, the Wine configuration dialogue box appears, where you can adjust Wine settings if necessary. The default setting is Windows 7, but you may want to switch to a more recent version, like Windows 10, since Windows 11 is not supported yet.

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 winetricks installed, use it to introduce additional Windows components not included with Wine. For instance, to install the 32-bit Microsoft fonts, use the command below:

winetricks allfonts

Additional Wine Commands

Wine Package Installation Example on Ubuntu: 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.

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

Configure Wine as 32-bit

Wine on Ubuntu can be configured to run both 32-bit and 64-bit Windows applications. While the default configuration supports 64-bit applications, adjusting settings to support 32-bit applications is possible.

For the 32-bit application setup, adjust the WINEARCH environment variable to “win32” and set the WINEPREFIX environment variable to a directory other than the default “~/.wine” directory.

To set WINEARCH to “win32”, enter the following command:

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.

Commands to Run Wine From Terminal

Execute Wine commands from the Ubuntu terminal for greater control over the running software. This section introduces and explains some commonly used Wine commands.

wine command

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

winecfg command

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

regedit command

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

Example:

wine regedit

winetricks command

Use the “winetricks” command to install additional components and libraries not bundled with Wine, selecting from a list of available components.

Example:

winetricks allfonts

winepath command

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

Example:

winepath -w /unix/path

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

wineserver command

The “wineserver” command oversees the Wine server, facilitating communication between Windows applications and Linux. Though rarely used, it can assist with debugging and 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.

Updating 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

Removing Wine

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

sudo apt remove winehq-stable
sudo apt remove winehq-staging
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’ve deleted the WineHQ repository, consider removing the GPG key with the command below:

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 vital for running Windows applications on Linux systems. With continuous updates and improvements, Wine maintains compatibility with a wide range of Windows applications, proving invaluable to Ubuntu users. Follow guidelines and documentation from WineHQ and Ubuntu communities for seamless installation and peak performance. Keeping Wine updated ensures access to the latest enhancements and compatibility updates.

Useful Links

Here are some valuable links related to using Wine on an Ubuntu system:

  • Wine Official Website: Visit the official Wine website for information about the compatibility layer, its features, and download options.
  • Wine Application Database: Explore the Wine Application Database (AppDB) to find information about application compatibility with Wine.
  • Wine Wiki: Access the Wine Wiki for comprehensive documentation, tutorials, and user guides.
  • Wine Help: Get help with Wine through various support resources, including documentation and FAQs.
  • Wine Forums: Join the Wine forums to discuss issues, share solutions, and get support from other Wine users.
  • Wine Bugzilla: The Bugzilla platform allows users to report bugs, track issues, and view bug reports related to Wine.

These links provide further information to help you effectively use Wine.

Joshua James
Follow me
Latest posts by Joshua James (see all)