In this tutorial, I will walk you through the steps to run Windows applications and games in Linux. As you probably know, Microsoft Windows uses DirectX to run games. So, It will be a lot easier to play some games that requires DirectX in Windows platforms.
But, what about Linux? Linux relies on OpenGL to run games. Of course, Steam for Linux has thousands of games already, and Steam works flawlessly on Linux platforms.
However, we still can install DirectX on Linux, and play games that requires DirectX without any problems. There are also some free and paid solutions such as PlayOnLinux, Crossover available to run windows apps and games in Linux platforms.
We can do it in two ways. Let us see them both.
Method 1 - Using Wine
Wine is a software that can be used to run Windows applications on Linux, Mac OS X, and Unix. Winetricks is a helper script that can be used to download and install various redistributable runtime libraries needed to run some programs in Wine.
Wine and Winetricks are available in the default repositories of most Linux distributions. So, you can easily install them using the default package manager. For example, on Arch-based systems, run:
$ sudo pacman -S wine winetricks
On Debian, Ubuntu, Linux Mint:
$ sudo apt-get install wine winetricks
$ sudo dnf wine winetricks
If winetricks is not available for your distribution, or out-dated, you can manually download and use it like below.
$ wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks $ chmod +x winetricks $ sudo mv winetricks /usr/local/bin
Next, install DirectX using command:
$ sh winetricks directx9
During installation, you will be asked to accept the license agreement.
Click Yes to accept and continue.
Select "I accept the agreement" and click Next.
Click Next to install DirectX runtime components.
The setup wizard will start to download and install DirectX components. Finally, click Finish to complete the DirectX installation.
Some games, for example League of Legends 4.x, requires corefonts, vcrun6sp6 and vcrun2008 applications. So, you need to install them too.
$ sh winetricks corefonts vcrun6sp6 vcrun2008
If you don't install the above packages, you might get the error:
Cannot Import dll:C:\users\xxx\Temp\is-00IEG.tmp\isskin.dll
That's it. DirectX has been installed now.
Run Windows Applications And Games On Linux Using Wine
As you already know, Some games or software will directly run from the CD or ISO Image. You can't run/play them without CD or ISO. So, you should leave them mounted or inserted in cd drive.
Let us create a directory to mount the Games.
$ mkdir mygames
Now, mount your game ISO in the mygames directory as shown below.
$ sudo mount -o loop <path-to-file.iso> mygames/
Once you mounted the ISO, go to the directory where you mounted the ISO and run the game as shown below.
$ cd mygames
$ wine setup.exe
Note: Some games might have install.exe. So, run the correct .exe file to start the games.
That's it. You should now see the game will start.
You can play some popular games such as FIFA, Need for speed, NBA as described in this method.
Also, you can install any available applications as well.
To list all available that can be installed using Winetricks, run:
$ sh winetricks apps list
To list all available games, run:
$ sh winetricks games list
I recommend you to check in the Wine Application Database before installing a game or app.
You can also use Winetricks GUI to install an application or game. Launch Winetricks GUI from your menu or application launcher. Choose what you want to install i.e an application, game, benchmark etc.
Choose the application you want to install and click OK.
Not only games and applications, you can even mount the Windows ISOs and run the setup files as well.
Here is how I run Windows setup using wine.
Method 2 - Using Winepak
Winepak is another useful utility to install and use Windows applications and games with Wine in Unix-like operating systems.
To use winepak, you must install Flatpak in your Linux distribution. Refer the following link to install Flatpak on Linux.
Flatpak basically lets the users to run applications in a sandbox with application-level dependencies included.
Once flatpak installed, run the following command to add the Flathub repository:
$ sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
Next, add the winepak repository using command:
$ sudo flatpak remote-add --if-not-exists winepak https://dl.winepak.org/repo/winepak.flatpakrepo
That's it. Now install an application or game of your choice. Here is the command to install Notepadd++:
Install an application using your software center or via the terminal:
$ sudo flatpak install winepak org.notepad_plus_plus.Notepad-plus-plus
You can find the Microsoft Windows applications you want by searching the winepak repository, either via the software center or the terminal.
$ flatpak search league of legends Application ID Version Branch Remotes Description com.leagueoflegends.Client 2018.07.19 stable winepak Join the League, become a legend
You can check the current list of applications here. Winepak repository contains very few applications at the moment. But I hope that other applications will make their way soon and the list grow.
Hope this helps.