How to Install Wine 9 on Ubuntu 24.04, 22.04 or 20.04

Wine 9 is the latest release of the popular compatibility layer that allows you to run Windows applications on Unix-like operating systems, including Linux. This version introduces major advancements, including the new WoW64 mode, which allows 32-bit Windows applications to run on a purely 64-bit Unix installation, enhanced Wayland support, and better ARM64 compatibility. Additionally, Wine 9 brings improvements to graphics, including Vulkan support, and updates to Direct3D, DirectShow, and DirectMusic, enhancing performance and compatibility with many applications and games.

To install Wine 9 on Ubuntu 24.04, 22.04, or 20.04 LTS, you can use the WineHQ repository, which offers the latest stable, pre-release, and development builds. This guide will walk you through the installation process using the command-line terminal.

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

With Wine 9 installed on your Ubuntu system, you can take full advantage of the latest enhancements in running Windows applications on Linux. The use of the WineHQ repository ensures that you have access to the most up-to-date features and improvements. Enjoy the improved compatibility, performance, and new capabilities that Wine 9 offers, enabling a seamless experience with Windows applications on your Linux setup.

Leave a Comment