Linux Applications

How to Install and Use Wine on Linux


When Linux was first released, it lacked much of Microsoft Windows’s programs had successfully implemented, so the users were facing many complications. As a result, Wine was created by Linux, a compatibility layer that enables Windows programs to run on Linux. Wine could originally run only a few Windows programs, but now it can run hundreds of them, making it a versatile Linux system. You would assume that Wine might be difficult to install and use due to the difficulty of getting such a tool to life, but this is mistaken. Wine’s creators have gone to great lengths to make the accessibility layer as user-friendly as possible. Let’s look at installing and confining Wine on Ubuntu to use it to run Windows applications.

Installation:

First of all, check whether your system is using a 32-bit processor or a 64-bit processor using the following command:

Now a systematic and easiest way to install Wine is through the standard Ubuntu repository. We can install it by using the following command:

ubuntu@ubuntu0:~$ sudo apt-get install wine64

Another way to install it is to collect basic Wine packages from the WineHQ repository and install them on your device.

Before downloading a 64-bit version, use the command given below to implement an i386 architecture.

ubuntu@ubuntu0:~$ sudo dpkg --add-architecture i386

Then to add the WineHQ key and the relevant repository, run the following sequence of commands:

ubuntu@ubuntu0:~$ wget -qO- https://dl.winehq.org/wine-builds/Release.key | sudo apt-key add -

Now Import the other key:

ubuntu@ubuntu0:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv F987672F

Adding the repository using the following command:

ubuntu@ubuntu0:~$ sudo apt-add-repository

'deb http://dl.winehq.org/wine-builds/ubuntu/ artful main.'

Now run any of the following two commands for installing the Stable version or the development version, respectively.

ubuntu@ubuntu0:~$ sudo apt-get install wine-stable -y

ubuntu@ubuntu0:~$ sudo apt-get install wine-development -y

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following packages were automatically installed and are no longer required:

fonts-wine gem gem-doc gem-extra gem-plugin-gmerlin gem-plugin-lqt gem-plugin-magick gem-plugin-v4l2

gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 grilo-plugins-0.3-base gstreamer1.0-gtk3 libcolamd2 libdazzle-1.0-0

libdca0 libe-book-0.1-1 libepubgen-0.1-1 libfreerdp-client2-2 libfreerdp2-2 libftgl2 libgavl1 libgc1c2 libglew2.0

lib merlin-avc1 libgom-1.0-0 libgpod-common libgpod4 liblirc-client0 libmad0 libmagick++-6.q16-7 libmediaart-2.0-0

libmjpegutils-2.1-0 libqqwing2v5 libquicktime2 librsync1 libsdl-ttf2.0-0 libsgutils2-2 libsuitesparseconfig5

libvncclient1 libwine-development libwine-development:i386 libwinpr2-2 libxapian30 linux-hwe-5.4-headers-5.4.0-42

lp-solve media-player-info puredata-core puredata-dev puredata-doc puredata-extra puredata-utils python3-mako

python3-markupsafe torsocks wine32-development:i386 wine64-development

Use 'sudo apt autoremove' to remove them.

The following additional packages will be installed:

libegl-mesa0:i386 libegl1:i386 libfaudio0 libfaudio0:i386 libgbm1:i386 libsdl2-2.0-0 libsdl2-2.0-0:i386

libwayland-client0:i386 libwayland-cursor0:i386 libwayland-egl1:i386 libwayland-egl1-mesa:i386 libwayland-server0:i386

libxcb-xfixes0:i386 libxkbcommon0:i386 libxss1:i386 wine-stable wine-stable-amd64 wine-stable-i386:i386

The following NEW packages will be installed:

libegl-mesa0:i386 libegl1:i386 libfaudio0 libfaudio0:i386 libgbm1:i386 libsdl2-2.0-0 libsdl2-2.0-0:i386

libwayland-client0:i386 libwayland-cursor0:i386 libwayland-egl1:i386 libwayland-egl1-mesa:i386 libwayland-server0:i386

libxcb-xfixes0:i386 libxkbcommon0:i386 libxss1:i386 wine-stable wine-stable-amd64 wine-stable-i386:i386 winehq-stable

0 upgraded, 19 newly installed, 0 to remove and 52 not upgraded.

When asked with a Y/n option for download, choose Y. Based on the Internet speed, the procedure can take some time. Now for verifying the installation, just type:

ubuntu@ubuntu0:~$ Wine --version

We have successfully installed Wine, but before we begin installing the application in Wine, we must first understand a few principles and how to set up Wine for use. As we know that a “C:” drive is used for Windows applications. So, Wine creates a simulated “C:” drive. Wineprefix is the name of that drive’s directory. We have to build a wine prefix first. We need to use the following command to do that :

ubuntu@ubuntu0:~$ winecfg

Click on Install and let it complete the mono installation.

Now Install Gecko by clicking on Install, and you are good to go. This will make a wineprefix and bring up the Wine setup pane. If you choose, you can change the setup settings or leave it alone for now and close it. The virtual C: drive can now be found at

$HOME/.wine/c_drive

Each new program should be installed into a new wine prefix as a general rule. We can manually build and manage several wine prefixes. Further Wine settings can be updated in the configuration window.

Once you are done, click Ok.

Wine engineers are constantly working on integrating support for more and more Windows programs, so it’s important to have the most recent version installed on your system. On the official Wine webpage, you can find a list of all the latest Wine-sponsored applications. Have a look at the support programs’ list to see if they’re a good match for Wine. The Rating score, which ranges from Platinum to Garbage, indicates this. You will also see which version of Wine the applications were reviewed with.

Usage

Let’s use Wine to run a windows application on our ubuntu system. In this case, we will use Windows Media Player, a popular media player for running media files on Windows operating systems for several years. First of all, download its “.exe” file. Once it is downloaded,  go to the downloads, right-click on the “exe” file and click “Open with”, “Wine Windows Programs loader”.

And we will be prompted to the installation process without any difficulty.

Conclusion

Wine has many benefits over emulators or virtual machines when operating Windows programs on Linux systems. Wine is resilient to the output degradation that happens when emulating other products. And it does not need to be opened before running a Windows program. Wine’s creators have put a lot of effort into making the accessibility layer as user-friendly as possible.

About the author

Usama Azad

A security enthusiast who loves Terminal and Open Source. My area of expertise is Python, Linux (Debian), Bash, Penetration testing, and Firewalls. I’m born and raised in Wazirabad, Pakistan and currently doing Undergraduation from National University of Science and Technology (NUST). On Twitter i go by @UsamaAzad14