2 Easy Ways of Installing Wine on Ubuntu 22.04 LTS

Try this guide with our instant dedicated server for as low as 40 Euros

Install Wine on Ubuntu

Linux (and open-source software) has come a long way in providing a robust and versatile environment for developers and users. In fact, regardless of your role in the organization, your Ubuntu machine has all the tools you need to get the job done.

However, there are still instances where you may need to run Windows applications on your Ubuntu system. This is where Wine, a compatibility layer for running Windows software on Linux, comes into play. 

In this comprehensive guide, we’ll discuss the two ways to install Wine on Ubuntu 22.04 LTS. Next, we’ll quickly go through some commands to start using Wine after the installation. 

Let’s start with a short introduction to Wine.

Table Of Contents

  1. How to Install Wine on Ubuntu 22.04
    1. Prerequisites
    2. Method #1: Install Wine from the Ubuntu Repository
    3. Method #2: Install Wine from the WineHQ Repository
  2. How to Update Wine
  3. How to Uninstall Wine
  4. Getting Started Using Wine
    1. Launching Windows Applications in Ubuntu
    2. The wine start Command
  5. Conclusion
  6. FAQs

What is Wine?

Wine stands for Wine Is Not an Emulator. It’s a free and open-source compatibility layer that allows you to run Windows applications on Unix-like operating systems such as Linux, macOS, and FreeBSD

Under the hood, Wine doesn’t emulate a full Windows environment. Instead, it translates Windows API calls into equivalent Unix/Linux calls. This approach provides a seamless platform for running many Windows applications on your Ubuntu system.

Let’s now go into the details of installing Wine on Ubuntu 22.04. 

How to Install Wine on Ubuntu 22.04

Linux offers two simple ways of installing Wine on Ubuntu 22.04. Let’s dive into the details of these methods.

Prerequisites

Before trying out the following methods, you should have:

  • A system running Ubuntu 20 Desktop or Ubuntu 22 LTS
  • A user account with sudo privileges.
  • Access to a terminal or command line

Method #1: Install Wine from the Ubuntu Repository

The standard way of installing Wine on Ubuntu is from the official Ubuntu repository. 

You should know that the official Ubuntu repository usually doesn’t have the most recent version. Instead, you get a slightly older but stable Wine version that works well with the Ubuntu platform.

Let’s go into the details of this method.

Step #1: Verify the Supported Architecture of Your Ubuntu System

Wine offers separate versions for the 32-bit and 64-bit Ubuntu versions. That’s why, it’s critical to find out the architecture of your Ubuntu installation. 

For this, launch the terminal and enter the following command: 

# lscpu

Look for the CPU op-mode(s) field in the detailed output of the command. Here’s a short description of the possible values of this field:

  • If it says 32-bit, your system runs on a 32-bit architecture OS.
  • If it says 64-bit, your system uses a 64-bit architecture OS.
  • If it says 32-bit, 64-bit, your system supports both types.

lscpu output

Step #2: Install Wine from Ubuntu Default Repositories

Start by updating the system’s package index to ensure you’re working with the latest stable package versions.

# apt update

Now, depending upon the value of the CPU op-mode(s) field, you can pick the 32-bit or 64-bit Wine version. 

Run the following command to install the 64-bit version of Wine:

# apt install wine64

Alternatively, if you want to install the 32-bit systems version, use the following command:

# apt install wine32

Step #3: Verify the Installed Wine Version 

Once the installation finishes, you should check to see if everything works as intended. For this, the easiest way is to check the installed Wine version with the following command: 

# wine --version

wine version output

Method #2: Install Wine from the WineHQ Repository

If you want the most recent Wine version on your Ubuntu of Wine, you can get it directly from the WineHQ repository. 

But before executing the steps, you need to prepare your 64-bit Ubuntu architecture for the 32-bit repositories. For this, run the following command: 

# sudo dpkg --add-architecture i386

sudo dpkg add architecture output

Step #1: Update and Add the GPG Key

Start by updating the package index with the following command:

# apt update

Next, add the GPG key for authenticating the repository you’d download in the later steps:

# wget -qO- https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -

sudo apt key add output

Next, add the required dependencies for the WineHQ repository:

# apt install software-properties-common

apt install software property output

Step #2: Download the Wine Repository 

Now, download the appropriate repository from the WineHQ website with the following command:

# sudo apt-add-repository "deb https://dl.winehq.org/wine-builds/ubuntu/ $(lsb_release -cs) main"

sudo apt add repository output

Once the download finishes, update the package list one more time:

# apt update

Step #3: Install Wine on Ubuntu 22.04

Finally, install the latest stable Wine version with this command:

# apt install --install-recommends winehq-stable

Alternatively, if you want the newest development version, use this command:

# apt install --install-recommends winehq-devel

Step #4: Verify the Installation 

Once the installation finishes, you should get the version information by running this command:

# wine --version

wine version output 2

NOTE: The APT package manager usually takes care of all dependencies and intermediate steps during the installation process. However, If you see an error message about something missing when installing Wine, use this command to get each missing dependency separately.

# apt install <package_name>

Then, run the wine installation command again.

How to Update Wine

The Wine team frequently updates the application, so you need to update the app on a regular basis. At the time of writing, the team releases a stable new version every 10-12 weeks.

For this, run the following command:

# apt-get upgrade winehq-stable

Wine sets up a directory in the home folder for its installations. It uses a pretend C:\ drive to understand commands. You can find this folder at /$HOME/.wine/drive_c/.

How to Uninstall Wine

If you need to remove Wine from your Ubuntu system, run this command:

# apt remove wine[version]

Use wine64, wine32, wine-stable, or wine-dev instead of wine[version] based on your installed version.

The command removes Wine but retains some configuration and related files. Use this command to get rid of all the extra files and directories you don’t need anymore.

# apt autoremove

Next, run the following commands to manually remove the directories in the wine directory in the Home directory. 

# rm -rf $HOME/.wine

# rm -f $HOME/.config/menus/applications-merged/wine*

# rm -rf $HOME/.local/share/applications/wine

# rm -f /.local/share/desktop-directories/wine*

# rm -f /.local/share/icons/????_*.xpm

After deleting the files and directories, run the below command to remove the references from the package index:

# apt-get remove --purge ^wine

To correct any installation errors, run the following sequence of commands:

# apt-get update

# apt-get autoclean

# apt-get clean

# apt-get autoremove

Now, Wine should be entirely removed from your computer.

Getting Started Using Wine

Use this command to create the setup folder for Wine’s settings.

# wineboot

This command makes a folder called ~/.wine and sets up everything Wine needs to work.

Launching Windows Applications in Ubuntu

If you’re using a visual interface on Ubuntu, just double-click a Windows .exe file to open it. Wine already knows how to handle these files. Alternatively, you can right-click the app, choose Open With, and then select Wine.

If you prefer using the command line to launch a Windows program, Use this command to move to the directory containing the exe file: 

# cd '/.wine/drive_c/program_folder'

Next, use the wine command to launch the file:

# wine launcher.exe

Replace program_folder with the real folder name where your app is. Swap launcher.exe with the name of the file you use to start the app.

The wine start Command

The wine start command is much more robust than the regular wine command. It helps Wine understand where to find configurations and related options. You can use it to point Wine to a particular application by giving the path to the command:

# wine start 'C:\program_location\launcher.exe'

wine start command output

Alternatively, you can specify a Linux path:

# wine start /unix "$HOME/program_location/installer.exe"

In the following example, we’ll demonstrate how to launch dotnet.exe. After successful installation, run the wine dotnet command to launch the application. 

wine start dotnet output

Important: We strongly discourage using Wine as the root user for safety. Running it with these high privileges can harm your system. 

Conclusion

Using Wine to run Windows applications on Ubuntu opens up a world of possibilities, allowing you to access software that may not have native Linux versions. So, the next time you find yourself needing a Windows application on your Ubuntu machine, don’t fret. Just install Wine and follow the steps outlined in this guide, and you’ll be running Windows software on Linux in no time.

Remember that while Wine is an impressive compatibility layer, not all Windows applications are guaranteed to work flawlessly. Compatibility can vary depending on the application and the version of Wine you’re using. It’s a good idea to check the WineHQ website for information on the compatibility of specific applications.

RedSwitches offers the best dedicated server pricing and delivers instant dedicated servers, usually on the same day the order gets approved. Whether you need a dedicated server, a traffic-friendly 10Gbps dedicated server, or a powerful bare metal server, we are your trusted hosting partner.

FAQs

Q. What is Wine, and why would I want to install it on Ubuntu?

Wine is a compatibility layer that allows you to run Windows applications on Linux-based systems like Ubuntu. Installing Wine on Ubuntu can be useful if you run Windows software without dual-booting or using a virtual machine.

Q. How can I install Wine on Ubuntu 22.04 LTS?

You can install Wine on Ubuntu 22.04 LTS by following the steps provided on the WineHQ website or by using the terminal command sudo apt install wine. Make sure to check for the specific instructions for the version of Ubuntu you are using.

Q. Can I install the latest version of Wine on Ubuntu 22.04?

You can install the latest stable version of Wine on Ubuntu 22.04 by adding the WineHQ repository to your system and then installing it using the package manager or the terminal.

Q. How do I configure Wine after installing it on Ubuntu?

After installing Wine on Ubuntu, you can configure it using the Wine Configuration tool or by adjusting the settings through the terminal or Wine’s graphical interface.

Q. Is it possible to run Windows applications on Ubuntu using Wine?

Wine allows you to run various Windows applications on Ubuntu. However, not all Windows software may work perfectly due to compatibility issues.

Q. How can I remove Wine from my Ubuntu system?

To remove Wine from your Ubuntu system, you can use the package manager or the terminal to uninstall the Wine package and remove any associated files and configurations.

Q. What is the process for installing Wine from the WineHQ repository on Ubuntu?

Installing Wine from the WineHQ repository on Ubuntu involves adding the repository to your system’s software sources, importing the repository key, and then installing Wine using the package manager or terminal command.

Q. Can I run Windows software on Ubuntu 20.04 using Wine?

Wine allows you to run Windows software on Ubuntu 20.04 by providing a compatibility layer that translates Windows API calls into Linux or Unix system calls.

Q. How do I use Wine to run Windows applications on my Ubuntu system?

A: To run Windows applications on your Ubuntu system using Wine, use the wine command followed by the path to the Windows executable file in the terminal.

Q. Where can I find the latest release of Wine for installation on Ubuntu?

The latest release of Wine for installation on Ubuntu can be found on the official WineHQ website. Make sure to download and install the version compatible with your Ubuntu system.

Try this guide with our instant dedicated server for as low as 40 Euros