How to Run Windows Software (and Games) on Linux with Wine
Although the various Linux distributions have a wide variety of software available, you may have a few Windows programs that you may not be willing or able to part with. Although many people dual-boot or use virtual machines to get around this problem, there is yet another potential option that many people new to Linux may not have considered--- Wine. Wine stands out from the other options because it does not require a separate Windows license.
Wine Overview
Wine is a program that allows you to run Microsoft Windows programs on Linux. Although it is emulator-like in appearance and by observation, Wine is not an emulator; in fact, the very name of Wine is an acronym for Wine is not an Emulator. A true emulator can emulate CPU architecture in addition to the actual software it is running. For instance, a program that could execute Intel x86-based Windows software on SPARC-based systems running the Solaris operating system would be a true emulator. However, Wine is actually a compatibility layer since both Windows and Wine run natively on x86 and no hardware emulation is required.
Wine works by recreating a miniature Windows installation in your home folder, (the .wine directory) complete with a virtual C:\ (drive_c) and registry. Contained within drive_c is a Program Files folder and a Windows folder complete with a system32 folder that has the most important Windows system files in it. Please note that these files are recreations of the Windows files of the same name rather than being the actual files that are included in a real Windows installation. In other words, the user32.dll file that comes with Wine is not the same file as the user32.dll that can be found in a real 32-bit Windows installation. Instead, each of the dll files in a Wine environment has been painstakingly reverse-engineered to match the functionality of the original as much as possible. Wine can also use actual Windows drivers if need be, but you must supply these yourself. Furthermore, Wine has its own implementation of the Windows registry with a knock-off of Regedit to configure it.
A compatibility layer like Wine is capable of translating Windows system calls to Linux system calls. Although it works as a translation layer, Wine runs in userland like any other program on Linux and has nothing to do with the Linux kernel. Everything a Windows binary does when you run it is funneled through Wine before being passed through to the rest of the Linux system. If the libraries needed by a Windows program are installed, this functionality allows the Windows software to run on Linux to some extent. This ultimately allows Wine to re-create the Windows API in a state that is somewhat similar to Windows XP. Some programs work better than others, but Wine is constantly improving and the list of fully compatible programs is always getting bigger. While Wine may run some programs adequately enough for production use, this will not be the case for every program you may need to use.
Although Wine strives to work as well as possible, it is not always a perfect solution for every problem. Wine's functionality is still determined on a per-program basis, and this may fluctuate drastically when you factor in certain variables that are determined based on your system configuration. WineHQ (the Wine developers' website) has a database of programs, with each entry assigned a rating based on how well it works on Wine. The ratings run from Platinum (works perfectly with no configuration required) on the high end to “Garbage” (does not work at all) on the low end. This rating may change from distro to distro, and may even fluctuate between distro versions; for instance, a hypothetical program may have a “Platinum” rating on Ubuntu 9.04, a “Gold” rating on Ubuntu 8.10, “Silver” on Gentoo, and a “Garbage” rating on any version of Mandriva. If the program you want to run has a “Garbage” rating, your only real choice is to dual-boot or use a virtual machine to run it. The good news is that once a program is in a usable state, it will probably stay that way in future versions of Wine unless you do something to break it.
Acquiring Wine
There are several ways to acquire Wine for any Linux distro. While most distros include a Wine binary somewhere in the main software repositories, the binary in question may be quite old and will not offer the best possible performance. With Wine, you should always use the latest version. Therefore, the best option is to acquire a Wine binary directly from WineHQ. For instance, Ubuntu users are able to add the WineHQ repository to their sources.list file. Binaries from WineHQ are updated regularly and are usually the latest stable version. However, not all distros have a separate WineHQ build. If your distro has a separate WineHQ repository, you should definitely use it, since this method allows you to keep your Wine installation up-to-date with the latest stable version without having to download and install packages manually every time there is an update.
For Ubuntu, add “deb http://wine.budgetdedicated.com/apt $version main”. ($version should be the nickname of your Ubuntu version, like hardy, intrepid, jaunty, karmic, etc) to your /etc/apt/sources.list file. (you need to use sudo or root for this) Next, add the GPG key for the repository: “wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -” Finally, run “sudo apt-get update” and then “sudo apt-get install wine”.
For OpenSUSE, (We assume you are using 11.1) add the following repository through YaST's Repository Management tool: “http://download.opensuse.org/repositories/Emulators:/Wine/openSUSE_11.1/” YaST will verify the repository and then install the key. Open the software installation tool in YaST and search for Wine. Choose the wine-snapshot package (make sure it comes from the WineHQ repository) and then install it.
Fedora users should just run “yum install wine” as root since that distro has no special repository for cutting-edge releases.
Likewise, Mandriva users should install the most recent version of Wine from the Mandriva software management tool.
Alternatively, you can always download the source from WineHQ and compile your own Wine binary-- you have to do it that way if you need to hack in extra functionality that does not come in the stock binaries. However, this is generally a last-resort option and is not beginner-friendly. If you customize Wine too much just to get one program running, it will probably break support for other programs. Furthermore, this method will not auto-update, so you will need to repeat the process every time a new version you want to update to comes out. Fortunately, the Wine build process follows the standard “./configure && make && make install” recipe, although it takes forever to compile.
Configuring Wine
Wine includes a powerful tool called winecfg that allows you to control how the system behaves. Winecfg appears as a Windows-style tabbed configuration window with options that allow you to to tweak the behaviors for Wine, including:
- Drives -- this allows the drive system that Windows uses (e.g. C:\) to be bound to the appropriate directories in your Linux filesystem. (the drive_c directory) Windows software is then able to access the fake Windows installation in drive_c, which is often required for proper function.
- Audio – This allows you to set and configure the audio driver that Wine should use.
- Applications – Wine is able to mimic specific versions of Windows on a per-application basis. (useful for legacy software that does not work well under NT)
- Libraries – This allows you to provide overrides for specific DLLs. You can choose to use to use the real Windows DLL (you must provide it yourself) or use the built-in Wine counterpart.
- Graphics – This allows you to turn on Wine desktop, prevent mouse escaping in DirectX applications, and define hardware-provided shader support.
- Desktop Integration – This allows you to install themes and control how specific user interface elements look.