How to Install Wine on Ubuntu 24.04

Wine is a software application designed to make Windows programs work on Linux. Wine acts as a compatibility layer, translating Windows system calls into Linux-friendly ones. This means you can install and run many popular Windows applications directly on Ubuntu.

In this write-up, we’ll demonstrate how to install, update, and remove Wine from Ubuntu using simple step-by-step instructions.

How to Install Wine on Ubuntu 24.04

Unlike traditional emulators, Wine does not slow down your system and is built to deliver better performance while bridging the gap between Linux and Windows software. However, Wine is not preinstalled and must be manually installed. You can download Wine and install it using Ubuntu’s default repository or WineHQ.

Try HostOnce’s Dedicated Servers for Ultimate Performance!

HostOnce gives you full control, powerful hardware, strong uptime, and top-level security. It’s a great choice for high-traffic websites and demanding applications.

Let’s start with the default Ubuntu Repository.

Method 1: Using the Default Repository

Installing Wine in Ubuntu is easy when you use the official apt repository. The official repository might not always install the most recent version of Wine. The official Ubuntu repository, however, guarantees the stable version of Wine.

Step 1: Check System Architecture

Wine has different applications for 64-bit and 32-bit architectures

lscpu
check system info

Step 2: Update System Repositories

This command will update your local repositories after detecting your CPU architecture:

sudo apt update && sudo apt upgrade
update system repos

Step 3:  Install Wine on Ubuntu

It’s now time to install Wine in Ubuntu after you have determined your CPU architecture. Install Wine if you have a CPU that is 64-bit:

sudo apt install wine64
install wine via apt

If you have a CPU that is 32-bit CPU, then run the following command to install Wine:

sudo apt install wine32

Step 4: Check Wine Version

Run the following command to verify that you have installed Wine correctly:

wine --version
verify wine version

Method 2: Using the WineHQ Repository

WineHQ’s repository is another way to install Wine. WineHQ contains the most recent Wine version, but it might not be stable. Install Wine using the WineHQ repository.

Step 1: Enable 32-bit Architecture

WineHQ can only be installed on a 32-bit system. Ubuntu stopped supporting 32-bit architecture in 2017. We can therefore assume that all Ubuntu systems are 64-bit.

Execute the following command to enable 32-bit architecture:

sudo dpkg --add-architecture i386
enable 32 bit architechture

Step 2: Update System Repositories

Update the local repositories once the 32-bit architecture has been enabled. To update Ubuntu before installing any packages, use the following command:

sudo apt update
update system repositories

Step 3: Add the Wine Repository Keys

Add security keys to your system before installing Wine. This will allow you to communicate securely with the repository. Run the following command to add security keys to your system:

sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
add wine repo keys

Step 4: Add WineHQ Repository

Add the WineHQ repository to your system. This is where you can install Wine in Ubuntu. Run the following command to add the WineHQ repositories to your system:

sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
add winehq repository

Step 5: Update Packages List

Update the system package list to include the WineHQ repository once the repository has been added.

sudo apt update
update packages list

Step 6: Install Wine on Ubuntu

Install Wine from the WineHQ repository. Run the following command to install the stable version of Wine from the WineHQ repositories:

sudo apt install --install-recommends winehq-stable
install wine ubuntu

Users can install the latest version of WineHQ through the following command:

sudo apt install --install-recommends winehq-devel

Step 7: Verify Wine Installation

Verify Wine’s installation after installing it by running the following command:

wine --version
confirm installation

How to Update Wine on Ubuntu?

You can upgrade Wine to the latest version if you have already installed it on Ubuntu. Executing the following command on Ubuntu will upgrade Wine to its latest version:

sudo apt-get upgrade winehq-stable
upgrade wine

How to Remove Wine from Ubuntu?

You can remove Wine if you have finished using it or if you want to remove it for another purpose. To do this, execute the following command.

sudo apt remove wine

This command will remove Wine but not its dependencies from Ubuntu:

remove wine via apt

You can also remove Wine’s dependencies using the following command:

sudo apt autoremove wine

Wine will also remove any other dependencies from other programs.

remove related dependencies

It is now recommended that you remove all folders associated with the Wine application. By executing these commands, you can remove the Wine folders one at a time.

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
remove all associated folders

After you have removed all folders, run the command given to remove all temporary files related to the Wine package.

sudo apt-get remove --purge ^wine
remove wine temp files

Execute the commands given one at a time to fix any errors.

sudo apt autoclean
autoclean ubuntu

Good to Know From domains to hosting, HostOnce has everything you need to launch your online project.

Conclusion

Wine can be installed on Ubuntu either from the official repository or the WineHQ repository. For the official repository, check your system architecture first, then install Wine64 for 64-bit systems or Wine32 for 32-bit systems. For WineHQ, enable 32-bit architecture, add its repository and keys, and install it using sudo apt install winehq-stable. In this article, we discussed both these methods with step-by-step instructions.

FAQs

First, enable 32-bit architecture using sudo dpkg --add-architecture i386. Add the WineHQ repository to your package list and then install Wine by using sudo install winehq-stable.

Wine can require additional fonts or libraries to function properly. Utilize winecfg for initializing the Wine environment. Also, for configuring such as the Windows version or graphics.

Some applications might not run perfectly with Wine. They may have bugs or not work at all. Before installing, it's a good idea to check their compatibility in the Wine Application Database.

To remove Wine, run sudo apt remove winehq followed by sudo apt autoremove to clean up unused packages. Also, delete the .wine folder in your home directory to remove leftover configuration files.

Author: Anees Asghar

Anees is a seasoned technical writer and WordPress expert with over 5 years of experience building and optimizing WordPress solutions. He also writes on Windows, Linux, MySQL, Java, and other technologies, creating practical content that helps developers and IT professionals.

Post a Comment

Your email address will not be published. Required fields are marked *