Pages

Wednesday, December 29, 2010

A Guide to Wine on Ubuntu for Beginners

This guide is divided in four parts, so that you can jump to whichever you want using the links below:

What Is Wine?
Installing Wine in Ubuntu (Two Methods)
Starting Up and Configuring Wine
Customizing Wine
What Is Wine?
Wine is a compatibility layer which allows Windows applications to run on Linux by translating Windows system calls into native Linux calls. Wine runs successfully a variety of Windows applications and games on Linux - the official website offers an application database which organizes those depending on how well they perform under Wine, known issues and solutions, screenshots and helpful comments.

You should give Wine a try if you have some Windows-only game or application that you really need and want to be able to use Linux for it.

Installing Wine in Ubuntu (Two Methods)
I will approach two different ways of installing the latest Wine release in Ubuntu: using the Wine PPA and compiling from source.
Using the Wine PPA

This method is pretty straightforward. First, we need to make sure that we uninstall any older version of Wine:
sudo apt-get remove --purge wine
Now, let's add the Wine PPA repository to our sources.list file:
sudo add-apt-repository ppa:ubuntu-wine/ppa
Finally, update the package lists and install Wine:
sudo apt-get update sudo apt-get install wine
This should be all.
Compiling Wine from source

This is usually not needed considering there is an updated repository available, but sometimes the PPA repository may have a delay until the packages are built and uploaded. Usually this happens immediately after a new version of Wine is released and there are no updated packages in the PPA. This is where compiling Wine from source could come in handy. Also, Ubuntu 10.10 Maverick Meerkat comes with the latest stable release of Wine, which is 1.2, so if you want the latest development release you will need to install it from the PPA or compile it from source.

First, make sure you have the sources repositories enabled, meaning a line that starts with deb-src is in your /etc/apt/sources.list file, like the following:
deb-src http://ro.archive.ubuntu.com/ubuntu/ maverick universe multiverse
If not, add it and save the file. Also, make sure to replace maverick with your actual Ubuntu version. Sources are enabled by default in Ubuntu, so you will probably need to do nothing at this step, unless you commented or deleted this line yourself.
Next, let's install the compilation tools, the needed development libraries and additional Wine dependencies:

sudo apt-get build-dep wine
sudo apt-get install libgsm1-dev libmpg123-dev
The first command will fetch the needed development libraries needed by Wine, together with the compilation tools like gcc. The second one will install two additional development libraries. Now, download the source tarball from the official website (direct link here), and then uncompress it by typing in a terminal (don't forget to make sure the current working directory is the one where you saved the tarball):
tar -xjf wine-1.3.9.tar.bz2
I used the latest version available at the time of writing, but replace the version number accordingly if it differs.

Next, enter in wine-1.3.9 directory and issue the following commands to compile and install it:
./configure
make
sudo make install
This will take a while, but in the end Wine should be properly installed. Alternately, you can specify a different installation prefix from the default, e.g.:
./configure --prefix=/home/USER/usr
In this case Wine will use /home/USER/usr (replace USER with your actual username) as the installation prefix, and you can issue make install as normal user, without the need of sudo. Notice that in this example Wine would install inside /home/USER/usr/bin/wine, so if you specify a different prefix don't forget to include the path to the Wine binary in your $PATH. Also notice that for older versions of Wine the commands needed to compile it should be ./configure; make depend && make; sudo make install.

If you need to uninstall Wine, issue the following command from within the wine-1.3.9 directory:
sudo make uninstall


Configuring Wine :

Winecfg

winecfg is used to configure Wine and change settings like sound, graphics, Windows version and so on. Wine uses the winecfg utility for configuration, which you can start either by typing winecfg in a terminal or pressing Alt+F2 and typing it there, followed by Enter. Note that the default settings usually will do, so it's not necessary to change the configuration options after installing Wine. When it starts for the first time, winecfg will prompt you to install Gecko, a web rendering engine used to embed HTML in applications (the same engine which is used by Firefox). It is recommended that you install it.

gecko

If you don't install Gecko now, you'll be prompted later when it is needed by some application or you will be able to install it manually using the winetricks script (which is explained below this section). After installing Gecko, let's have a look at the Wine configuration window:

wine_configuration

I'll briefly explain each tab:
  • Applications tab: this is used to set different Windows versions for different applications. The default (Windows XP) should be fine for most of them.
  • Libraries tab: here you can add dynamic link libraries (DLLs) and specify whether they should be a Wine builtin or a native Windows binary; this will be used to copy various libraries needed by certain games or applications to run properly.
  • Graphics tab: in this tab you can specify graphics settings, emulate a virtual desktop and choose its resolution, change Direct3D vertex shader options and set fonts dots per inch (DPI).
  • Desktop Integration tab: in this tab you will be able to change the look of Windows applications that run through Wine, and also to change the theme which it uses (this is explained below in the section Customizing Wine).
  • Drives tab: this tab allows you to set drive mappings, which will give Wine access to certain devices and drives on your system. Default is usually fine, but you may need to add an optical drive here for applications which require the CD or DVD.
  • Audio tab: the first time you click on this tab a message window will appear notifying you that a recommended driver has been selected. Click OK, then in the Audio tab click Apply. You can also test the sound using the Test Sound button. Default settings should be fine.
  • About tab: optionally you can fill in the Owner and Organization text fields (anything will do).
wine configuration

Winetricks

Winetricks is a powerful script which automates installation of various useful packages, offering a friendly interface to do so. Before downloading and using winetricks, first let's install the cabextract package, which is a native Linux application that extracts Microsoft Cabinet files (CAB), and is available in the repositories.

No comments: