Windows/Linux Cooperation

Windows/Linux Cooperation

From PCLinuxOS Wiki

Jump to: navigation, search

Contents

Configuring Wine

Introduction Windows On Linux

Wine is an open source implementation of Windows API. The name was derived from the recursive acronym "Wine Is Not an Emulator" (it implements a compatibility layer). In layman's terms, wine allows a user to run Windows programs under linux. Wine is still in beta release form, and as such, still has some unimplemented functions and bugs, which may make running certain Windows program impossible. However, the Wine project is making huge strides to support as much software as possible and many of the commonly used programs can run fairly comfortably under Wine. For a (somewhat) complete listing of "supported" applications, visit Wine App Database. There are a number of Wine-related projects that can act as alternatives, among them are CrossOver Office (see PCLOS page on CrossOver), TransGaming Cedega, and VMWare (see Installing Software).

Installing Wine

To install Wine, use Synaptic. The wine package contains the binary files needed to run WIndows software under Linux. The wine-devel package contains headers and libraries needed to develop programs under wine, and is not needed for most users.

User Configuration

Since configuring Wine has to be done through the command line, it may at first seem a little daunting (especially to a new user). But don't worry - this guide will walk you through it step by step. Unlike some of the alpha versions (usually identified by YYYYMMDD versions such as 20050725), the beta versions (identified by 0.9.x versions) are much easier to configure. To start, simply run wine from the command line:

wine

This will create a //.wine// hidden directory inside the current user's home directory. To view its content:

ls -al ~/.wine

Inside the //.wine// directory will be another directory called //drive_c//, and possibly a symbolic link //c// to //drive_c//. This directory will serve as wine's equivalent to //C://, the windows root directory. All additional wine related files (such as installed program and DLLs) and directories (such as Program Files and Windows) will reside within //drive_c//.

Note: since the //.wine// directory resides in a particular user's home directory, every user will have their own .wine directory with their own copies of the installed programs!

The rest of configuration is done through the winecfg tool, which can be started by

winecfg

This wine configuration GUI will allow the user to

Configure default Windows version
In Applications tab, click on Default Settings and select the desired windows version in the Windows Version box - recommended version are Windows 2000 and Windows 98, the latter having a bit more support than the former.
Configure application specific Windows version
Some application simply won't run under some versions of wine. So, instead of changing your default version of WIndows, you can specify the Windows version of specific installed applications: in Applications tab, click Add application button, and browse to the executable for which you want to change the Windows version, then, in Windows Version box, select the desired version.
Configure libraries
In order for wine to work, the project created a number of "builtin" libraries, which are equivalent to windows "native" DLLs. Sometimes the "builtin" DLLs are missing functionalities needed for some installed programs. The user can then google for the desired DLL, download it to //~/.wine/drive_c/windows/system// and tell wine to use this DLL instead of the "builtin" one: in Libraries tab, type in the name of the DLL (without the .dll extension) in the New override for library box and click the Add button.
Define Windows drive letter mappings
Much like //~/.wine/drive_c// is wine's mapping to //C://, the user's linux home directory //~// can be mapped to, say, //H://. This allows the user to access files and directories throughout the entire system while running a wine application (usually a File Open or File Save dialog boxes).
Audio and Video configuration
More advanced configuration can be performed using this tool. However, most users will never have to do this on their systems.

To assist in further configuration, a number of people have created several configuration tools, such as WIneTools and ies4linux. These programs allow the user to easily install system utilities like Windows fonts, Internet Explorer, Flashplayer, and many other programs and utilities.

Running Programs under Wine

Running installed programs and installing new programs is actually the same topic since both are achieved by running a .exe file. In other words, to start a program (even a setup.exe program), simply type

wine /path/to/windows/program.exe

to start the execution. For most programs, running an exe from the terminal will display a lot of debug information (such as certain functionality is not supported, or error loading some library). Hopefully, none of those messages will be show-stoppers and the started program will just work. However, if it doesn't, don't despair. Look in the terminal and see if you can make sense of what is displayed there. It may be possible to fix the problem by running winecfg and selecting a different Windows version or redefining some DLLs. Please remember that even though wine is making great strides to improve its functionality, it is still a beta. If all else fails and your installed program simply won't run and you want to recover the disk space, you can uninstall programs by running

uninstaller

and removing the installed wine program.

Understanding Wine File Structure

Note: This is an advanced topic. Linux noobies beware! The easiest say to understand the wine file structure is through the eyes of a Linux file structure. Let's say your system is dual boot with windows: your windows partition is /dev/sda1 your root partition is /dev/sda2, and your home partition is /dev/sda3. Then, your filesystem may look like:

/                           <= PCLOS root (mount point of /dev/sda2)
|-/dev
| |-/mnt
| |-/floppy
| |-/win_c                  <= existing windows partition "root" (mount point of /dev/sda1)
|   |-/Program Files
|   | |-/Application1
|   |   |-/program1.exe     <= program on windows partition installed through windows
|   |-/Windows
|-/home                     <= user home directory (mount point of /dev/sda3)
| |-/.wine       
|   |-/drive_c              <= wine's fake windows "root"
|     |-/Program Files
|     | |-/Application2
|     |   |-/program2.exe   <= program installed through wine
|     |-/windows
|-/usr

All programs that were already installed on your Windows partition can be started by typing in the following

wine "/mnt/win_c/Program Files/Application1/program1.exe"

into the command window. Note that this is case sensitive, and you must have the quotes around the path because it contains spaces. If you have installed new programs through wine, then those can be started by typing in the following

wine "~/.wine/drive_c/Program Files/Application2/program2.exe"

into the command window. Again, note the case and the quotes.

Upgrading Wine

The wine project is rather good at releasing upgrades on a regular basis. Eventually, you will want to upgrade your wine installation (be it through Synaptic or by building your own source). Don't panic: your ~/.wine directory will remain intact even if you remove the old version of wine and install a new version later. This way, your installed programs will still be there even after the upgrade.