Open Source

Run Windows applications on Linux with WINE

See how WINE works and how you can use it to runs Windows apps on Linux/UNIX systems.

One of the biggest reasons why some organizations resist the move to Linux is the lack of applications available for Linux users—or, more specifically, the lack of Windows applications. However, just because you want to run Linux as your operating system, that doesn't mean you have to abandon your favorite Windows application. You might be able to get it to run on Linux using WINE.

What's WINE?
WINE is an ongoing project that is intended to allow Linux users to run Windows applications in a Linux environment. Although not all Windows applications will run under WINE, WINE is undergoing constant changes and many Windows applications can now be made to run under WINE.

Although there are quite a few Windows applications that just don’t work with WINE and other Windows applications that install on WINE but crash frequently, there are still several reasons for using WINE. The biggest reason is to get away from Windows. Let’s face it, it’s easy to get an office suite for Linux, but most companies are unable to completely make the transition to Linux from Windows because they have a couple of mission-critical applications that simply do not run under Linux.

Companies might want to move from Windows to Linux for a number of reasons. For starters, there have been rumors that Microsoft has been considering adopting a software license model, which requires you to lease all of your Microsoft software on an ongoing basis. Many companies simply could not afford to do this. Running Linux and WINE would release you from the Microsoft monopoly.

Another reason for making the switch is because of all of the security holes in Windows. If a hacker group managed to find a major vulnerability in Windows, it would be theoretically possible to exploit that vulnerability on 80 percent of the world’s computers. However, if you switched to Linux and ran WINE, you would not be affected by any vulnerabilities that might exist within the Windows operating system because you would not be running Microsoft code.

Please note that I’m not writing this article to debate which is the better operating system. I only want to point out that there are some valid reasons why companies that have already rolled out Linux to a limited degree may want to press forward in their transition.

OK, so there are some reasons why it might be desirable to run Windows programs on Linux, but why use WINE? Why not just use an emulator such as VMWare? The truth is that when WINE works, it outperforms VMWare. Furthermore, if you want to emulate a Windows virtual machine, VMWare requires you to purchase a copy of Windows to install within the virtual machine. While it’s true that VMWare works really well, you are actually running an operating system on top of an operating system (Windows on top of Linux). This makes for some really slow performance. By the time that you pay for a copy of VMWare and the high costs associated with running Windows, running VMWare tends to be a bit pricey too.

WINE, on the other hand, is not an emulator. WINE simply uses a WIN32 API to make Windows code run on a native Linux / X Windows system. In theory, adding an extra layer of abstraction should slow things down a little bit. However, assuming that you have decent hardware, Windows applications running under WINE should perform comparably to native Linux applications. This raises the question of what constitutes decent hardware.

Hardware requirements
WINE’s hardware requirements are minimal to say the least. The first requirement is that WINE requires an X86 processor. A common misconception is that WINE is an emulator and can, therefore, run Windows applications on other platforms, such as Solaris. This is simply not true. In fact, the name WINE is an acronym that stands for Wine Is Not an Emulator. Because WINE is not emulating an X86 processor, an actual X86 processor is required.

To be more specific, WINE requires a minimum of an 80386 processor. The 80386 processor addresses memory in a very different way from prior Intel processors, and WINE depends on these differences. Even though WINE will technically run on an old 386 machine, don’t expect to be able to dig an old 386 with a 20 MB hard driver out of the closet and run WINE on it. WINE requires a whole lot more hard disk space than the low processor requirements might lead you to expect. You will need at least 250 MB of disk space just to store and compile the WINE source code. Additionally, the installation requires about another 70 MB of disk space, 20 MB of which must be available within your TMP directory.

It seems that the jury is still out on WINE’s memory requirements. There is a lot of contradictory information on the Internet regarding WINE’s memory requirements. The one thing that all of the sites do agree on though is that WINE’s debugger is memory hungry. One Web site claimed that it is possible, but not advisable, to run WINE with 8 MB of RAM and an 8-MB swap file. Another Web site suggested that 16 MB of RAM was the minimum but that WINE was painfully slow even with 24 MB of RAM. There seems to be a general consensus, though, that WINE will do a decent job of running most supported Windows applications if the computer has at least 64 MB of RAM.

Obtaining and installing WINE
Installing and configuring WINE takes a lot of work. The first step in the process is to download the WINE binaries. You can download the binaries from the WINE HQ Web site. The installation process differs depending on your Linux distribution type.

Linux distributions from Red Hat, Mandrake, and many others require you to install the binaries through the RPM command. To do so, you would enter the following command:
RPM –I WINE-xxxxxxxx-I386.RPM

In this command, xxxxxxxx represents the version number of the WINE RPM file that you have downloaded.

If you are using a Debian-based Linux distribution, you will use a different command to install the WINE binaries. The command is:

Whichever technique you use, the WINE binaries will be installed in the /USR/LOCAL folder unless you specify a different location.

Configuring WINE
Before you can use WINE, you must verify that the WINE configuration file is in the correct location. Most of the time it won’t be. After the initial installation, the configuration file will exist within the /URS/SHARE/DOC/WINE-xxxxxxxx/SAMPLES folder. You must copy this file to the ~/.WINE folder. To do so, you would enter the two commands shown below. The first command creates the ~/.WINE/ folder while the other copies the configuration file.

The configuration file has a lot to do with how well or even if an application will run. The default configuration file will work fine for a lot of applications, but there are times when you may want to tweak it. Tweaking the configuration file is beyond the scope of this article, but if you would like to see how it’s done, check out the directions found at the WINE Web site.

Installing and running Windows applications
Now that WINE is installed, you are probably anxious to try running a Windows application. Unlike Linux, most Windows applications have an executable Setup program. Usually this application is named SETUP.EXE, but the name does occasionally vary.

To install a Windows application, the first thing that you have to do is to make the CD that contains the application available to Linux. You can do so by using the following two commands:

Now, simply issue the WINE command followed by the name of the Windows executable that you want to run (usually SETUP.EXE). The command would look like this:

When you run SETUP.EXE, you will launch the installation wizard for the application. Just follow the various prompts to complete the installation. If Setup completes successfully, then you are ready to run your Windows application. The next section of this article explains exactly how to go about doing so. If the Setup program crashes or hangs, though, then you will have to do a little clean up work.

If you have a Setup program that has hung, then the first thing that you must do is to press [CTRL][Alt][F1] to return to the main console screen. Now, login as root and then use the following command to kill the hung process:

This should terminate any processes that are running under WINE, but the process doesn’t always work. You must verify that the WINE-related processes have indeed been terminated. You can do so by issuing the following command:

This will list the currently running processes. If any WINE processes are listed, then pay attention to the process ID. Now, issue the following command where yyy is the process number for the process that you need to terminate:
KILL -9 yyy

Running a Windows application
Now that I have shown you how to set up a Windows application, let’s take a look at how to run the application once it has been installed. I recommend starting out with something simple. Try running Notepad. Notepad is actually built in to WINE and you can run Notepad just by entering NOTEPAD at the command line. If Notepad runs, then it means that your configuration file is set up correctly and you can try running a more elaborate application.

Basically, running a Windows application involves switching to the Windows directory, and then calling WINE along with the application name. In the example below, I am using APDIR to represent the name of the folder where my fictitious Windows application is installed. I am also using APPLICATION.EXE to represent the application’s executable. With this in mind, you would launch your Windows application by using the following two commands:

If Notepad fails to run, then WINE hasn’t been installed or configured correctly. In order to work, WINE requires some specific directories to be present beneath the .WINE/ directory. Normally, these directories should be automatically created during the installation process, but you can check to make sure that the directories actually exist. If they don’t exist, try creating them manually. The necessary directories include:
  • .wine/c_drive
  • .wine/c_drive/Windows
  • .wine/c_drive/Windows/Fonts
  • .wine/c_drive/Windows/Start Menu/Programs
  • .wine/c_drive/Windows/System
  • .wine/c_drive/Windows/System32
  • .wine/c_drive/Windows/Temp
  • .wine/c_drive/Program Files
  • .wine/c_drive/Program Files/Common Files

In case you are wondering, Linux doesn’t use drive letters (C:, D:, etc.) the way that Windows does. Windows applications expect to have access to a lettered drive. WINE treats the .WINE/C_DRIVE folder as the C: drive.

Another thing to check for is for the existence of the SYSTEM.INI and WIN.INI files within the .WINE/WINDOWS directory. Again, these files should already exist, but if they don’t, you can copy them from the WINE-xxxxxxxx/DOCUMENTATION/SAMPLES directory.

Earlier, I briefly mentioned the WINE configuration file. You shouldn’t normally have to change anything in the configuration file to get Notepad to run. If Notepad doesn’t run, though, you might check to make sure that the correct paths are specified within the configuration file. This is also a good time to make sure that the configuration file has the correct map point for the CD-ROM drive. The CD-ROM drive’s map point doesn’t really have anything to do with Notepad running or not running, but checking the map point now may save you some troubleshooting later when you try to run a real application.

Installing TrueType fonts
One of the biggest problems with using WINE to run a Windows application is that many Windows applications rely on TrueType fonts. As you may know, TrueType fonts are not natively supported by WINE. Therefore, if you have an application that is TrueType-font dependent, you’ll have to make Linux know what to do with TrueType fonts.

The easiest method for doing this is to download an X font server for TrueType fonts called XFSTT. If you need the RPM file, you can get it from this RPM resource xfstt page.

Once you download and install the TrueType font server package, you will have to copy the TrueType fonts off of a Windows machine to your Linux machine. If you had a dual boot machine, the steps for copying the TrueType fonts from Windows to Linux might look something like this: (Keep in mind that the steps below assume that you are using the directory name c_drive as the C: drive for WINE.)

At this point, you must restart the font server. You can do so by issuing the following command:

The TrueType fonts should now be accessible to X Windows. One way to tell for sure is by running XFONTSEL to see which font families are available. You can do so with the following command:

Keep in mind that WINE is dependent on both Linux and X Windows. Unless TrueType fonts are functional within X Windows, they will not work with WINE.

Leaving Windows behind for good
As you can see, there are situations where it may be more advantageous to run a Windows application on a Linux box than on a Windows box. In these situations, it is more cost effective and more efficient to use WINE than a Windows emulator. WINE may not be perfect, but if you're intent on running Windows applications while leaving Windows itself behind, WINE may be the way to go.

Editor's Picks

Free Newsletters, In your Inbox