Help answer threads with 0 replies.
Go Back > Linux Answers > Applications / GUI / Multimedia
User Name


By indubitableness at 2010-03-22 19:26
This tutorial started off as a reddit post that ended up getting out of hand. The original poster asked for guidance regarding gaming in Linux. This tutorial covers relatively advanced (probably closer to intermediate) use of Wine.

Before you start, please be familiar with these pages: (Wine home page) (This is where you go to learn how to run tricky games)

The appdb page is very important. It will tell you which games work and on which versions of Wine they have been tested. The appdb becomes increasingly important when you come across games that need added dll files and/or registry edits to install and run in Wine.

Note: This Answer is Ubuntu specific, because the original poster specifically asked about using Ubuntu.

Before I continue with my rant about gaming on Linux I would like to point out right now that the very first thing you should do when you install your ubuntu set up is to run the following:

user@ubuntu$ sudo aptitude update  
user@ubuntu$ sudo aptitude install ubuntu-restricted-extras
This will provide you all your required media codecs for proprietary video and audio formats, which are not included with Ubuntu.

Back to Gaming

Many distros include Wine in their repositories. Ordinarily this will be Wine 1.0.1, the stable release. Instructions for updating to new versions, which the Wine developers do not recommend but I do, can be found at If you are using Slackware Linux, you can obtain a trustworthy binary from

Wine creates a directory called .wine that resides in your home directory. This directory is what is known as the default wine prefix. WINEPREFIX is the environment variable that dictates where the Wine prefix will be. You can change this variable to a different location in order to separate applications. Each Wine prefix acts as a separate Windows "machine."

Example code:

user@ubuntu$ WINEPREFIX=/home/user/MicrosoftWord
user@ubuntu$ echo $WINEPREFIX
The first line shows how to set the Wine prefix, the second line shows how to refer to it. Note that when defining the variable you do not use a dollar sign ($). When referring to the variable in a command the $ must be used to tell the system that it is using a variable.

The $HOME variable is equal to your home directory so it can be used to replace the /home/user bit in the command above. It is recommended that you place all your Wine prefixes within a single directory. You can put this directory wherever you please. I use $HOME/.wine/wineprefixes. It is also useful to set a shortcut variable to this location when working with Wine such as:

user@ubuntu$ export prefix=$HOME/.wine/wineprefixes
user@ubuntu$ mkdir $prefix/SteamGames
user@ubuntu$ WINEPREFIX=$prefix/SteamGames winecfg
Skip This if You Understand the Above Code

As you can see in the above example I have created the variable prefix and set it to represent the absolute path /home/user/.wine/wineprefixes. I declared this variable in my .bashrc file. The second command creates a directory to be used as a Wine prefix. This one is intended for Steam.

Note that the last command in this series ends with winecfg. When running Wine commands such as winecfg, it is important to set the WINEPREFIX variable immediately before running that command. While WINEPREFIX can be set system-wide, it is a clunky and unreliable way of doing things. When you run this command it will prepare the specified Wine prefix, getting it ready for the installation of applications and bringing up a configuration GUI.

Don't Skip This

Pay careful attention to the Drives section of the configuration GUI that pops up, as this is where you can add a D:\ drive and set its location. I use /media/iso, which is where I mount physical disks and disk images when I am installing Wine games. Also be aware of the drive_c directory within any Wine prefix. This is the C:\ directory folder and I heartily recommend working from inside of that directory when installing and running games and apps. Sometimes to run a game you must be working from inside the game's install path itself.

Write scripts to launch your games and make shortcuts to them. This is covered later in this tutorial.

Other commands to be aware of:

wine cmd        #Emulates a windows command prompt, required to run batch files
wine regedit    #Sometimes you need to make registry edits to get a game working
wineboot         #Simulates a windows shutdown, useful for when apps act up
wine msiexec  #Used to run msi files. This command accepts Windows
                        #    style arguments. Use /i to install.
All the above command can be used as such:

user@ubuntu$ WINEPREFIX=$prefix/SteamGames [command]
Running Applications

wine is the command used to actually run your Wine apps. Make sure you set the Wine prefix to the appropriate place.


user@ubuntu$: cd $prefix/SteamGames/drive_c
user@ubuntu$: WINEPREFIX=$prefix/SteamGames wine ./Program\ Files/Steam/Steam.exe

Note: For clarity, note that ./Program\ Files/ above cuts off strangely. Be aware that the backslash \ character is required immediately before the space on the command line to insert the space between Program and Files, otherwise the system will interpret the word Files as a separate command rather than a part of the directory name.

This is the appropriate way to launch a correctly installed Steam application. Remember, you can put your Wine prefixes wherever you want. If you choose to use a variable as a shortcut to your Wine prefix, you can name it whatever you want.

Always remember tab completion. As you can see some of these commands get pretty tedious. Use your bash history and tab completion. Then when you're satisfied with your set up and sure the game or application runs, write scripts to launch them. I store these in $HOME/bin. I also use $HOME/sbin for system scripts.

Be sure to include code to move you into the appropriate working directory.



cd $prefix/SteamGames/drive_c ;
WINEPREFIX=$prefix/SteamGames/ wine ./Program\ Files/Steam/Steam.exe ;
exit 0
How Do I Install the Application? What you've seen so far should have familiarized you with how to form Wine commands, how to use Wine prefixes, and how to run applications. So taking what you know, it should be simple for you to now install a game. Take your physical disk or backup ISO disk image and mount it. Assuming you've set up your Wine prefix to use /media/iso as the D:\ drive, you would do this as follows. First, create the directory, if necessary, like so: [codee]sudo mkdir /media/iso
then mount with

sudo mount /dev/dvd /media/iso

sudo mount -o loop /path/to/game.iso /media/iso
Look for the setup file within the disk or image file

ls /media/iso
If you don't see it immediately, look around the subdirectories until you find it. Once you do you can run it using the wine command. Remember to set your wine prefix.

WINEPREFIX=$prefix/ApplicationName wine /media/iso/Setup.exe
If you are installing from an msifile, such as the case for Steam, the above command would be:

WINEPREFIX=$prefix/steam wine msiexec /i /path/to/steaminstall.msi


winetricks is particularly important for newer games. I like to download winetricks into my $HOME/.wine directory. You might choose to keep it in your $prefix directory or somewhere else on your system entirely (perhaps $HOME/bin). winetricks is used to install proprietary DLL files required by some games into Wine.

winetricks is used like any other Wine command. When invoked on its own, it will bring up a GUI list, using $HOME/.wine as its default Wine prefix. You set the Wine prefix exactly the same way as with any other Wine command.

WINEPREFIX=$prefix/AppName winetricks
If you get unexpected permission errors make it executable first:

chmod u+x /path/to/winetricks
Unless you add winetricks in your $PATH (not covered) or are currently working in the same directory as the winetricks script, you will need to specify where it is:

WINEPREFIX=$prefix/AppName /path/to/winetricks directx9
Note that I added the argument directx9 to the command this time. winetricks can take arguments to specify which DLL packages to install. I use directx9 because it is the package most often needed when running newer games; winetricks can take multiple arguments. Check the wine app database to find out which dlls are needed to run your games or applications.

NOTE: Do not report bugs about Wine when using winetricks as proprietary DLLs can not be legally supported by the Wine development team.

That just about covers it. Let me know if you find this helpful.

by dinakumar12 on Fri, 2010-04-02 08:45

i have installed wine but while tried to install adobe photoshop cs4 and dreamweaver cs4 in my linux pc. its not getting installed.Does wine have any role to play in this problem.

thanks in advance,

by Telengard on Sat, 2011-05-07 19:58
The tutorial should be updated because aptitude is no longer included with Ubuntu by default as of 10.10 Maverick Meerkat.


All times are GMT -5. The time now is 05:29 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration