Playing Windows games on Ubuntu with Wine

Slashdot it! Delicious Share on Facebook Tweet! Digg!
© Shanna Korby - Fotolia.com

© Shanna Korby - Fotolia.com

Days of Wine

, ,

Although Ubuntu has made great strides in gaming, we sometimes miss the games that are only available on Windows. Linux provides a way to solve this problem with Wine, the Windows "not an emulator."

Wine [1], which is a recursive acronym for "Wine is not an emulator," is an infrastructure of applications and libraries that allows Linux users to execute programs developed for Windows. Versions of Wine also exist for BSD, Mac OS X, and Solaris.

As its name spells out, Wine is not an emulator as such, nor is it a virtualization program; instead, it is an open source implementation of Windows APIs, a series of "libraries" that allows you to execute Windows applications in Linux in much the way Microsoft executes old applications (e.g., MS-DOS applications) in compatibility mode.

Wine is available in Ubuntu's official repositories [2] and can be installed with your package manager of choice. The alternative is to use the official repositories of the project to ensure the latest version is installed with all the most recent security, performance enhancements, and other improvements.

Wine Installation

Wine can be installed several ways. It is an obligatory package in every self-respecting distro, and on Ubuntu you can install it with:

sudo apt-get install wine

The second approach is to install Wine through the project's official repositories, as mentioned above. For Ubuntu, that means adding the Wine repository to your system by executing:

sudo add-apt-repository ppa:ubuntu-wine/ppa

Note that for Ubuntu versions older than 9.10, you must add the repository manually.

To do this, go to Applications | Ubuntu Software Center , choose Edit | Software Sources , click the Other Software tab, and then press the button Add . In the APT Line text box enter

ppa:ubuntu-wine/ppa

and press Add Source . Now you can install the latest version of Wine directly through the Software Center.

The last way to install Wine is from the sources available online [3], but this method is tedious and complex because of the large number of dependencies, so we will not go through that process in this article.

Savoring Wine

Once Wine and all of its dependencies are installed, it is ready to use. Before this, we should make some remarks about the way the program works to maintain interoperability between Windows programs and your Linux system.

Wine's root directory is $HOME/.wine , which is the .wine folder in the home directory of the user. This directory is created the first time you run Wine. Wine includes a pair of programs that allows you to check whether everything has installed correctly. In the example, you can run Windows' Notepad application by opening a terminal window and typing:

wine notepad

For the time being, you can ignore all the error and warning messages that Wine shows and cancel all dialog windows (for a smoother and error-free Wine execution, see the "WineTricks" box).

WineTricks

Often, when you try to install a program, you will find that, to complete the install, you need certain add-ons for Windows, such as the Visual Basic 6 run time or the .NET framework.

A possible solution is to hunt for the package from the official website and install it by hand. Good luck with that. This option is not only frustrating (because it is not always possible to find said packages or libraries easily) but also tedious, especially when you need to add several packages.

A much better option is to use WineTricks [4], a program that allows you easily to find and install all the dependencies that your program could need.

To install it on Ubuntu, you must have Wine's PPA repository configured first. If you have added the repository when you installed Wine, you only have to install the package winetricks with the command:

sudo apt-get install winetricks

When you need to use it, you can execute it in a terminal with:

winetricks

When executed, a dialog comes up that lets you choose the libraries you want to install (Figure 2). Highlight the ones you need and press OK . The program will then download and install them automatically.

Figure 2: Winetricks makes solving the installation of Windows' program dependencies a piece of cake.

We recommend that you execute winetricks from a console to see what the program is doing because its GUI does not display the progress of what it's downloading.

Once you have your first Windows program running on Linux, take a look at the directory structure of Wine (Figure 1). Go to Notepad's Menu | File | Open , open up the locations box (Look in: ), and choose My Computer . You'll see two drives: C: and Z: .

Figure 1: Explore Wine's directory tree with Notepad.

Drive C: contains the "system" files that Wine requires to work. It contains the windows directory with libraries and executables, Program Files , and users . Drive Z: corresponds to the Linux root folder (/ ). In this way, Wine allows you to access your files on Linux outside its own directory tree.

On the Linux side, open a terminal and list the contents of .wine in your personal directory:

ls .wine

Here, you'll find the following folders:

  • dosdevices : Contains the mapping that Wine does of the different drives. In this case, it contains c: mapped to the drive_c directory, which is the system's drive; and z: , which is mapped to the Linux root directory (/ ).
  • drive_c : Contains the directories that Windows needs to be able to execute applications.

Inside this directory, you will find:

  • Program Files : Where Windows programs will be installed.
  • users : Where the user profiles are.
  • windows : Where the system files are.

When you install Windows programs through Wine, they will be installed in .wine/drive_c/Program Files . If you need any additional libraries to execute the program, you would need to copy them to .wine/drive_c/windows/system32 .

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $0.99
(incl. VAT)

Buy Ubuntu User

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content