Update and Upgrade Linux System
The first step is to update and upgrade the packages on a Debian-based Linux system. The command listed below updates the package list and upgrades all installed packages to their latest versions recommends running it regularly to ensure that your system is up to date with the latest security and bug-fix updates.
[sudo] password for omar:
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:8 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB]
Reading package lists... Done
Check Architecture
The command “lscpu” is a command line tool used to display information about the CPU architecture of a Linux system. Information like the number of CPUs, cores, clock speed, and architecture are displayed.
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 39 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 1
Install Wine Using Apt
Here is a command used to install the Wine compatibility layer for 64-bit Windows applications on a Debian-based Linux system, such as Linux Mint. The keyword “install” is used to install a new package and “wine64” is the package name for the Wine compatibility layer for 64-bit Windows applications.
When you run this command, apt-get will first updates the package list to ensure that it has the latest information about available packages. Then, it will begin to download and install the package “wine64” and its dependencies. It will also check for any conflicts with other packages and will ask you to confirm before making any changes. The command’s output should appear something like this:
Building dependency tree... Done
The following additional packages will be installed:
fonts-wine gcc-12-base:i386 glib-networking:i386 gstreamer1.0-plugins-base:i386
Need to get 275 MB of archives.
After this operation, 1,380 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Processing triggers for wine (6.0.3~repack-1) ...
Check Wine Version
“wine –version” is a command in the terminal or command prompt to check the version of Wine. The “–version” flag tells the system to display the version number of Wine, which can be useful for troubleshooting or making sure that the correct version is installed.
wine-6.0.3 (Ubuntu 6.0.3~repack-1)
Uninstall Wine
The command shown below is useful when you want to completely remove the wine64 package and all its dependencies from a Linux system. This can be useful if the Wine package is causing issues or if you no longer need it. The “purge” is an option that tells apt-get to completely remove the specified package, including any configuration files and dependencies. Apt-get is instructed to also delete any packages that have been installed, as dependencies of the package getting uninstalled but are no longer required by using the “—autoremove” option. In the end, the package name of the one we wish to uninstall is “wine64.” Once the process is completed, Wine will be removed from your Linux Mint system. Please be aware that to run the command, you must be a root user or have sudo access.
[sudo] password for omar:
Reading package lists... Done
Building dependency tree... Done
The following packages will be REMOVED:
fonts-wine* glib-networking:i386* gstreamer1.0-plugins-base:i386*
After this operation, 1,344 MB disk space will be freed.
Do you want to continue? [Y/n] y
Purging configuration files for libgdk-pixbuf-2.0-0:i386 (2.42.8+dfsg-1ubuntu0.2) ...
Install Wine Using Wget
The attached command is used in the terminal or command prompt to add the i386 architecture to the list of architectures that dpkg (Debian Package Manager) can work with. This command is useful when you want to install software that requires the i386 architecture,\ but your system only supports the x86_64 architecture. It is also useful when you want to install a package that is not available in your system’s architecture.
We need to download the WineHQ archive key, which is used to verify the authenticity of WineHQ packages when they are installed on a Linux system. To be sure the key file is authentic and has not been interfered with, it is essential to get it from the official WineHQ website.
--2023-01-17 12:45:54-- https://dl.winehq.org/wine-builds/winehq.key
Connecting to dl.winehq.org (dl.winehq.org)|151.101.2.217|:443... connected.
HTTP request sent, awaiting response... 200 OK
Saving to: ‘/usr/share/keyrings/winehq-archive.key’
/usr/share/keyrings/wine 100%[================================>] 3.14K --.-KB/s in 0s
2023-01-17 12:45:55 (21.8 MB/s) - ‘/usr/share/keyrings/winehq-archive.key’ saved [3220/3220]
Now, download a package repository file from the official WineHQ website and save it to the /etc/apt/sources.list.d/ directory, we will be using the “wget” instruction shown below. This file contains information about the package repository, such as the location of the packages and their versions. Adding this repository file to the system allows the system to access the WineHQ packages and it can be used to install or update Wine on the system.
--2023-01-17 13:13:32-- https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
Connecting to dl.winehq.org (dl.winehq.org)|146.75.106.217|:443... connected.
HTTP request sent, awaiting response... 200 OK
Saving to: ‘/etc/apt/sources.list.d/winehq-jammy.sources’
winehq-jammy.sources 100%[================================>] 163 --.-KB/s in 0s
2023-01-17 13:13:34 (532 KB/s) - ‘/etc/apt/sources.list.d/winehq-jammy.sources’ saved [163/163]
After downloading the Wine key and package repository, we will try to update our system.
Ign:1 http://packages.linuxmint.com vera InRelease
Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:5 https://linux.teamviewer.com/deb stable InRelease
To install the stable version of WineHQ on a Linux system, run the attached instructions on the shell. The “–install-recommends” option ensures that any recommended packages that are required for WineHQ to function properly are also installed. This command will also update an older version of the winehq package if it is already installed on the system. “winehq-stable” is the package name of the package that we want to install.
Reading package lists... Done
Building dependency tree... Done
The following additional packages will be installed:
gstreamer1.0-plugins-base:i386 libapparmor1:i386 libasound2:i386 libasound2-plugins:i386
find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0)
The first-time installation will take us to this mini-installer shown in the image. Tap the “Install” button to continue.
The wine-mono package will be downloaded and installed after a while and you can use it now.
Use Wine in Linux Mint
To start using Wine on Linux Mint, we will have some “exe” files to be executed. Therefore, we have downloaded the “exe” file for “notepad” in our current directory as follows:
Desktop Music npp.8.4.8.Installer.x64.exe Templates
Documents new.txt Pictures Videos
Downloads Public Warpinator
Run the notepad “exe” file using the “wine” keyword as follows:
0074:fixme:imm:ImeSetActiveContext (0x25e860, 0): stub 012c:fixme:imm:ImmReleaseContext (000000000001019C, 0000000000F520B0): stub
The installer will ask to choose a language and press “OK” to carry on.
After going through the welcome screen, you will have to accept the license agreement, select the location to install notepad, and choose the components to install it and it will be ready.
Conclusion
Wine can be installed on Linux by using the package manager of your Linux distribution or by downloading the source code and building it manually as we have discussed above in the article. Once installed, you can use the “wine” command to run Windows executables. It’s worth noting that Wine is not perfect and not all Windows applications will run correctly or at all, some may have limitations or not work at all, hence before using wine it’s recommended to check the compatibility list of the software you want to run on the wine website.