Hi!

Here on this “how to” I’m going to explain how Wine works and show some basic commands to get started with.

Wine is a free and open-source software that creates a compatibility layer capable of running Windows applications on different OS such as Linux, BSD or Mac OSX.

I’m not writing much about its history, there are plenty of information on the official website or Wikipedia.

Anyway I like to point out that Wine stand for Wine Is Not an Emulator, that the initial release dates back in 1993 and that more that 1500 developers worked on this project so far.

Wine is mostly used to run games but it can also execute any other application.
If you’re interested in trying or switching to Linux but the lack of native ports stops you every time, well, mind that Wine gives the opportunity to run almost every Windows-only games up to DirectX9, it may also outclass the newer Windows OS in terms of compatibility with older software.
So expect to successfully run on your Linux machine classics and series like: Bioshock, Fallout, Red Faction, Dead Space, Age of Empires, Far Cry, Assassin’s Creed, Company of Heroes, The Elder Scrolls, Mass Effect, Diablo, Total War and soooooo on…

Here on my blog you can find some of the games that I personally tested using Wine.
On the Wine website there is a database full of information where everyone can post an entry of a specific application.

I strongly suggest you guys not to get afraid of the fact that Wine is a command-line only software.
It is a very straightforward software and once you get how it works you’ll find it very simple and rational.
If you’re still too scary about the “evil-terminal” consider using Crossover or Play On Linux, which is a software that provides a graphical interface to Wine (I used Play On Linux too), anyway you won’t learn to use Wine by using POL.. (I’m going to make a “how to” for POL soon).

If you need help just leave a comment :)

That said let’s get started!!


    1. Install Wine from your distro’s repository (Vanilla or Staging?)
    2. Why and how create a 32- or 64-bit WINEPREFIX
    3. Install and run an application
    4. GOG and DRM free games
    5. Fix a game with Winetricks
    6. Wine Staging and Wine Gallium Nine
    7. Install Steam client and games
    8. Create a script to easily install/launch Steam games
    9. Delete, copy, backup a WINEPREFIX
    10. Install different Wine versions

  • Install Wine from your distro’s repository (Vanilla or Staging?)

Alright let’s install Wine from the disto repository.

Wine comes in 2 “flavors”: Wine or Wine Staging (the former is known as “vanilla”).
Wine Staging is a patched Wine version that comes with some additional bug fixes, it normally improves gaming performances so I suggest to install this version.

Also you should select a development version instead of a stable version.
Wine improves at every new release, if something was working on an old version, it’s very likely that it works even better on a newer version.
The 2 version are recognizable by the number after the first period:
even numbers for stable versions (such as 1.6, 1.8, 1.8.2 and so on..)
odd numbers for development (1.7.43, 1.9.15, etc..)

The installation process changes based on which distro you’re using, and some distro (such as Arch Linux) have the very latest version available by default in the repositories, while other distro (Debian, Ubuntu) have a very outdated version and add an external repository would be better.

Here is the official Wine page on how to install it on different distros

In my case (Arch Linux and derivative) I just need to run:

sudo pacman -S wine

or

sudo pacman -S wine-staging

to always install the latest development version straight out of the repositories!


  • Why and how create a 32- or 64-bit WINEPREFIX

Wine gives the user the ability to create different PREFIXES.

This to prevent some applications to break each other, to easily manage 32-bit or 64-bit applications and so on.

I always use a clean prefix for every game that I test, unless the games are very similar. I suggest you to do so, while learning, or at least try to separate those games/applications that need some heavy tweaks to get them to run.
I also install 32-bit games on a 32-bit prefix, even if they may run on a 64-bit one, so in many cases I won’t be able to get a 64-bit game (such as Planetside 2) on these prefixes, I would need to create a new one.

These prefixes are separated virtual Windows drives with different settings.

For example, you may install some software in a prefix and using it as Windows 8, while on another one run some old games in windowed mode, or a 64-bit one where you’re using a patched-wine versions dedicated just to that prefix, etc..

Wine creates a default prefix named .wine in the home directory, so if a specific prefix isn’t set, it uses that one.

To create a new prefix run this command:

WINEPREFIX=~/test1 winecfg

this will create a wine prefix in your home directory called “test1” and then open the wine configurer. Notice that on a 64-bit system this operation creates a 64-bit wine prefix.

To create a new 32-bit prefix run:

WINEARCH=win32 WINEPREFIX=~/test2 winecfg

  • Install and run an application

Now let’s assume that you have 3 games and want to install them on 3 different prefixes (1 of them being 64-bit), then run:

WINEARCH=win32 WINEPREFIX=~/game1 wine ~/Downloads/installer1.exe
WINEARCH=win32 WINEPREFIX=~/game2 wine ~/Downloads/installer2.exe
WINEPREFIX=~/game3-64bit wine ~/Downloads/installer3-64bit.exe

These operations create 3 different prefixes and run the game installer on the dedicated prefix!

As happens in Windows the installer installs the main game .exe file in the created directory, to run you game redirect Wine to that launcher:

WINEPREFIX=~/game1 wine ~/game1/drive_c/game1-directory/game1-launcher.exe

At this point the game should launch and be playable as in Windows, but in many cases you’ll need to add some DLLs to the clean Wine prefix to get the game to run correctly.
Notice that there is no WINEARCH=win32 anymore, this because the prefix is already created and that variable isn’t needed, the architecture is set and won’t change.

To make a clearer example I’ve installed Far Cry 2 (GOG version) on a clean 32-bit prefix, here are the screenshots:

And S.T.A.L.K.E.R. Shadow of Chernobyl (GOG):


  • GOG and DRM free games

If you have some GOG games you can try to install them as I did here above. But mind that you may encounter some issues:

  • Installer

The gog installers run fine but sometimes they freeze or end with some errors, most of the time the games get correctly installed, but if you’re encountering some problems try to run the installer with this argument:

/nogui

here are some example with Fallout 1 and Fallout 2 both installed in the same prefix:

  • Main game Launchers and Shortcuts

Even with all the errors both Fallout 1 and 2 got correctly installed. But I encounter another issue with the games launchers and main .exe files, they don’t work..

I’ve also end up with the same situation with a few other games but I find a way to easily bypass this problem.

If you check the screenshots above you can see that I unchecked the “create a desktop shortcut” when installing Fallout 1 but this option wasn’t there when installing Fallout 2 with /nogui , instead there is one on where to install some “Start Menu shortcuts”.

At the end I had a Fallout 2 shortcut on my desktop folder, meaning that the /nogui option always create a shortcut (you can see just 1 shortcut icon on the virtual desktop above).

And guess what.. Fallout 2 runs fine if launched from that shortcut!! Cool!! but how to get Fallout 1 to correctly launch if I didn’t create a shortcut during the installation???

Well, luckily the GOG installers always create some “Start Menu shortcuts” in a folder named “GOG.com” that by default is located in:

.../wineprefixname/drive_c/users/Public/Start Menu/Programs/GOG.com

Anyway to get these shortcut to run you need to run them with:

wine start

because these are .lnk files and wine throws you an error if you run them the common way.
Now both Fallout are running fine:


  • Fix a game with Winetricks

I was lucky until now because all the game that I installed run out of the box, but in many cases some tweaks and fixes may be needed!

To show this I’m going to install the other 2 S.T.A.L.K.E.R. games on the already created prefix.

Anyway after the installation S.T.A.L.K.E.R. Clear Sky refuses to launch while Call of Pripyat runs fine (actually it wasn’t working when I tried the first time yesterday but I can’t reproduce that error anymore, it just runs!)

Now how to get the game to launch??

Well, I normally follow these steps even before trying to install a game:

  • If the game requires DirectX10 or 11 it probably won’t run with Wine (AT THE MOMENT!), so before buying/trying a game check if the game uses or at least if there is a supports for DirectX9.
  • Even better if the game supports WindowsXP; if so it’s most likely that it runs perfectly out of the box or with some easy tricks!
  • Run the game from the terminal to see what errors Wine debugs to you, and focus on the “fixme” that end with “stub”
  • Experiment different solutions in different newly created prefixes, if something goes wrong no other application will be afflicted.
  • Take a look at the Wine Apps Database to see what other users did to get the game to run.
  • Check websites like PcGamingWiki.com to see if there are any tricks or tweaks to improve the game performances. Keep in mind that you’re running Windows games with Wine and not native Linux games. If a game is broken on Windows it’ll probably be broken on Wine too, but the same trick to get it to work on Windows should work on Wine.
  • Add some additional debug information to what Wine already outputs.

Most of the time Winetricks solves all the problems that prevent an application to run correctly.

Winetricks is a software that should be installed together with Wine during the installation from the repository.

In some apt-get based distros you need to add –install-recommends to get winetricks to install.

sudo apt-get install --install-recommends wine

With it some Windows libraries (such as d3dx, .NET, vcrun, etc..) can be easily installed and in some cases replacing Wine components with the closed source one.

Winetricks can be used both with a GUI or from the command-line.

In any case I always use it with the -q variable, so that it skips some boring “accept this, accept that” and manage to better install some libraries such as .NET

WINEPREFIX=../wineprefix winetricks -q

To get S.T.A.L.K.E.R. Clear Sky to run I had to install “d3dx9” , and I did that straight from the command-line. As I had some other errors pointing an issue with “vcrun” I also installed that one but using the Winetricks as GUI, check the screenshots:

As you can see there are various vcrun based on what year they were released. How I did I know that vcrun2005 was this right one? why not vcrun2008 or the others?

Well I actually didn’t know that it was the right one.. I just supposed that it was.

And something is easy to guess what kind of library you need to install. For example the 3 S.T.A.L.K.E.R. games use the X-Ray Engine, and the first game, Shadows of Chernobyl, was released back in 2007, so I guessed that they worked at the engine/game at least 1-2 years before, thus my guessing to install vcrun2005.


  • Wine Staging and Wine Gallium Nine

Hero on my blog I post a lot of screenshots of games running with different Wine versions, take a look at these tests to see the differences between them.

Mind that Gallium Nine is available only when using the MESA open source drivers, and performs great especially on AMD.

I previously suggested to install Wine Staging instead of vanilla Wine and now I’m going to tell how to enable its most important feature: CMST (Commandstream multithreading).

This option can be turned on/off on the winecfg staging tab:

CSMT gives better performances by optimizing OpenGL calls, you can read more about it here.

ps. normally there is no “enable Gallium Nine” options, continue reading for that one.

A Gallium Nine enabled Wine is by far the version that I prefer and it’s likely to run a DirectX9 game with the same Windows performances (sometimes better).

As I said before Gallium Nine is open-source drivers specific and it won’t run with the proprietary Nvidia drivers! Gallium Nine is build on top of the Gallium framework and it comes by default with the open-source drivers.

If the CSMT patch optimize the Direct3D calls to OpenGL, Gallium Nine bypass them so the the Direct3D calls go to the Gallium API.

A great interview with many other infos can be found on GamingonLinux.com

There are different ways to enable Gallium Nine, on Ubuntu/Linux Mint there is an external PPA.
On Arch Linux I use to install this package from the AUR. To install it, the yaourt way, run:

yaourt -S wine-gaming-nine

and update it by running (it will also update your entire system and any other AUR packages):

yaourt -Syua

Then enable it in the Staging tab by checking “enable Gallium Nine”, CSMT will automatically disable if selected (see the screenshot above).

That AUR package comes with many other hacks, in particular it fixes the Steam store page and other stuff, that’s why I’m using it even when I’m on Nvidia with the closed source drivers.


  • Install Steam client and games

The Windows Steam Client is needed to get Steam Windows games to run on Linux with Wine.
Sadly there’s still no chance to install and manage games running with Wine from the Native Linux Client.
But this is not a big deal because the Client running with Wine does a great job especially when managing the games dependencies in a clean prefix.

That said let’s install the client in a clean prefix:

As I mentioned before I’m using a patched version of Wine that fixes the steam store issue, based on which Wine version you use you may not see the store/discussions/profile pages. Anyway the Library always works, so the games installation!
Once the client is installed and works correctly I suggest you to leave that prefix just for Steam, and install a game/s in a different prefix, to prevent some successive tweaks to break Steam. Once it is there, leave it alone :)

Steam by default installs the client under the “Program Files” folder (“Program Files (x86)” if using a 64-bit prefix), however I suggest to install the Client before that folder, so it can be easily accessible.

The Steam client isn’t perfect under Wine, sometimes some errors appears (such as the panel icon not appearing/unresponsive, some random crashes, etc..), anyway the download and installation process work perfectly and, unlike the GOG installers, the Steam client manages the game dependencies extremely well!

At this point why not to install a game?!?
Steam games can be installed as you already know: open the client, select a game, click install and launch it.
BUT… I’m going to show you a different way to install the games. An easier way!

Steam recognize every single game with a specific identification number, called “App ID”.

These IDs can be found in the url of a specific game when browsing the store page, or in many external websites, such as the very useful Steamdb.info

With these App ID Steam can install/launch a game straight from the command-line, without the need to scroll your Library to look for the game.
In fact with a single command it’s possible to create a new prefix and launch the client straight to the game installation, thanks to this argument:

-applaunch [App ID]

so, if the Client is normally launched by running Steam.exe like this

wine .../Steam/Steam.exe

to install/launch a game one can simply add the argument with the correct App ID number:

wine .../Steam/Steam.exe -applaunch [App ID]

Let’s install Red Faction guerrilla for example!

once the installer is launched you need to log in and to select where to install the game.

Everything external to the prefix appears as Z: and Steam by default set the installation in its own prefix, so in my case Steam will always locate the installer in:

Z:/home/user/.steam-blog/drive_c/Steam

So every time you want to install a game, be sure to install it in the right prefix, which is anywhere inside the C: directory!

Once you did that the installation starts. To check the download status you need to open the client from the Steam icon, anyway a notification will appear when the installation is complete, even if the client stay hidden.

Now you’re ready to launch the game! If you need to prevent the game to mess up your resolution, close the client and enable a virtual desktop, then relaunch the game.

But guess what?! The game crashes at launch pointing an issue with DirectX11, so how to get it to work? Wasn’t the game Dx9 compatible?

Well, yes the game is dx9 compatible but it launches by default in dx11 mode, so we have 2 options to get the game to work:

  1. launch the client and then select the dx9 mode; boring solution, way too many mouse clicks and the -applaunch variable will always end with a crash.
  2. Set a launch option so that the game always launch in dx9 mode, also when launching the game with the -applaunch variable from the terminal.

Let’s take a look at GamingPcWiki.com to see how to tweak our game with some launch options:

This was just to show how to fix an error that can occur in Windows too, for example if you have WindowsXP you’re going to suffer the exact same error.
Plus you can tweak the game a bit with these launch options, such as skipping the intro videos and so on..

The game then launches fine and a correct resolution can be set so to enjoy the game fullscreen!


  • Create a script to easily install/launch Steam games

Alright! If you read everything until this point you are probably saying yourself “do I need to always open that goddamn terminal and write all that crap for every single game?”.

NO you don’t! until now I explained the basics on how wine works and how to use Steam with it. With these solid basis we can now simplify and standardise the way a game is installed/launched by creating a script, to make things way easier and less boring :)

This is the way I like to manage my games, you can do the same or use these hints as a source and create something different that fit your needs.

I like to put all my shortcuts and prefixes in 2 hidden folders under my home partition, this because I don’t want my home directory to be full of files/folders. Let’s keep things neat!
I’ll call these main folders .launchers and .prefixes

create the 2 folders:

mkdir .launchers .prefixes

allright now let’s create the first shortcuts that will serve as base for the others (I’m using Red Faction Guerrilla as example):

nano .launchers/rf_guerrilla

and edit the empty file with the followings *(scroll down to see how to locate wine):

export WINEARCH=win32
export WINEPREFIX=~/.prefixes/rf_guerrilla

WINE=/usr/bin/wine
STEAM=~/.steam-blog/drive_c/Steam/Steam.exe

$WINE $STEAM -applaunch 20500

Done! now I need to make the file executable by running:

chmod +x .launchers/rf_guerrilla

Now the file can be executed from the terminal:

.launchers/rf_guerrilla

at first launch it creates a new 32-bit directory and executes the steam game installation using the specified wine, after the shortcut executes the game!

Now, to install another game (let’s install Red Faction 2) I just need to copy that file (it will be copied as executable):

cp .launchers/rf_guerrilla .launchers/rf_2

modify the wineprefix and App ID:

nano .launchers/rf_2
export WINEARCH=win32
export WINEPREFIX=~/.prefixes/rf_2

WINE=/usr/bin/wine
STEAM=~/.steam-blog/drive_c/Steam/Steam.exe

$WINE $STEAM -applaunch 20550

and execute the new shortcut to install and lauch the game

.launchers/rf_2

Now let me install a 64-bit only game, the free-to-play Planetside 2:

cp .launchers/rf_2 .launchers/planetside_2
nano .launchers/planetside_2

to create a 64-bit prefix just “comment out” the WINEARCH line with #
By doing so that line will be ignored so that wine creates a 64-bit prefix

#export WINEARCH=win32
export WINEPREFIX=~/.prefixes/planetside_2

WINE=/usr/bin/wine
STEAM=~/.steam-blog/drive_c/Steam/Steam.exe

$WINE $STEAM -applaunch 218230

then launch the game as usual:

.launchers/planetside_2

If you’re using the open-source drivers you can easily add the GALLIUM HUD to a game:

GALLIUM_HUD=fps .launchers/planetside_2

There are many other variables and stuff to add to these scripts, here I just wanted to show the basics, but I’m going to write a more specific post soon (link will be here).

*to locate the path to your default wine run:

find / -name winecfg 2>/dev/null

If you search for “wine” many more path are going to appear, anyway the main Wine binary and “winecfg” are in the same directory.
I added “2>/dev/null” to skip all the “permission denied” messages.


  • Delete, copy, backup a WINEPREFIX

To delete a prefix, and all its content, simply run:

rm -rf .../prefixname

Notice that this operation doesn’t ask confirmation and cannot be undone, so be sure to remove the right prefix eheh.
This is is useful if you created a wrong prefix, if you needed a 64-bit but created a 32-bit-one, to free some space and so on.

For other purposes you can copy a prefix or the shortcuts (for example to an external drive):

cp -ar .../prefixname .../directoryname

or compress them to save space:

tar -zcvf games.tar.gz game1 game2 game3 ...

Wine automatically updates the prefix when a change is detected, such as a new Wine version, and the risk of breaking an application is minimal in my opinion, just be sure to respect the right paths!


  • Install different Wine versions

coming soon..