Saturday, October 07, 2006

Installing Wine on Ubuntu

Wine (Wine Is Not an Emulator) is a open source reimplementation of Microsoft's Win32 API. It's useful for those who want (or need) to run Windows-only software on non-Windows OSes.

There's 2 methods of getting Wine up & running on your Ubuntu machine. First, is to install from the Wine repositories, and the other method involves fetching a copy of the Wine source from git and compiling it yourself.

Method 1: Installing from Wine's repository

Add Wine's repository to your sources.list file:

$ sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
$ sudo nano /etc/apt/sources.list

and add the following @ the end of the file:

# Wine repository
deb http://wine.budgetdedicated.com/apt dapper main
deb-src http://wine.budgetdedicated.com/apt dapper main

Save changes, then install the latest stable Wine release along with the binfmt-support package (so you can double click to run programs like in Windows instead of using the CLI):

$ sudo apt-get update
$ sudo apt-get install wine
$ sudo apt-get install binfmt-support

Although Ubuntu's repositories also come with Wine, it tends to be a bit outdated so using Wine's repository is much better if you need more up-to-date Wine versions.

Method 2: Installing Wine from source

Installing Wine from source means you get to use bleeding edge Wine. The downside is that it's more likely to be problematic than the stable releases.

There's a lot of additional packages to install to get Wine from source. Here's the long list of what's needed:

$ sudo apt-get install libasound2-dev
$ sudo apt-get install libarts1-dev
$ sudo apt-get install libartsc0-dev
$ sudo apt-get install libaudiofile-dev
$ sudo apt-get install libesd0-dev
$ sudo apt-get install libaudio-dev
$ sudo apt-get install libcapi20-dev
$ sudo apt-get install liblcms1-dev
$ sudo apt-get install libcupsys2-dev
$ sudo apt-get install libsane-dev
$ sudo apt-get install freeglut3-dev
$ sudo apt-get install libc6-dev
$ sudo apt-get install libexpat1-dev
$ sudo apt-get install libfontconfig1-dev
$ sudo apt-get install libfreetype6-dev
$ sudo apt-get install libgcrypt11-dev
$ sudo apt-get install libglib1.2-dev
$ sudo apt-get install libglib2.0-dev
$ sudo apt-get install libgnutls11-dev
$ sudo apt-get install libgpg-error-dev
$ sudo apt-get install libice-dev
$ sudo apt-get install libieee1284-3-dev
$ sudo apt-get install libjpeg62-dev
$ sudo apt-get install libldap2-dev
$ sudo apt-get install libltdl3-dev
$ sudo apt-get install libmad0-dev
$ sudo apt-get install libmng-dev
$ sudo apt-get install libncurses5-dev
$ sudo apt-get install libogg-dev
$ sudo apt-get install libopencdk8-dev
$ sudo apt-get install libpng12-dev
$ sudo apt-get install libqt3-mt-dev
$ sudo apt-get install libsm-dev
$ sudo apt-get install libtasn1-2-dev
$ sudo apt-get install libusb-dev
$ sudo apt-get install libvorbis-dev
$ sudo apt-get install libx11-dev
$ sudo apt-get install libxcursor-dev
$ sudo apt-get install libxext-dev
$ sudo apt-get install libxft-dev
$ sudo apt-get install libxi-dev
$ sudo apt-get install libxml2-dev
$ sudo apt-get install libxmu-dev
$ sudo apt-get install libxrandr-dev
$ sudo apt-get install libxrender-dev
$ sudo apt-get install libxslt1-dev
$ sudo apt-get install libxt-dev
$ sudo apt-get install libxv-dev
$ sudo apt-get install render-dev
$ sudo apt-get install unixodbc-dev
$ sudo apt-get install x-dev
$ sudo apt-get install xlibs-static-dev
$ sudo apt-get install zlib1g-dev
$ sudo apt-get install xlibs-dev
$ sudo apt-get install libxxf86dga-dev
$ sudo apt-get install libxxf86vm-dev
$ sudo apt-get install libjack0.100.0-dev
$ sudo apt-get install libicu34-dev
$ sudo apt-get install libungif4-dev
$ sudo apt-get install libssl-dev
$ sudo apt-get install build-essential
$ sudo apt-get install make
$ sudo apt-get install gcc
$ sudo apt-get install flex
$ sudo apt-get install bison

Once that's done, you'll need to get the latest Wine source from git. First thing is to get git installed on your system.

WARNING: There's more than one git. One is GNU's git (which I'm not sure what it's for) and the other is the version control system we need to download the latest Wine source.

To get the git we need, do the following:

$ sudo apt-get install git-core

Then, do the following to get the latest Wine source:

$ git clone git://source.winehq.org/git/wine.git wine

This may take a while to complete, so be patient.

Once that's done, you'll need to compile the downloaded source:

$ cd wine
$ make depend && make
$ sudo make install

Updating Wine source is just a simple command away (so long as you didn't make changes to the source) for the non-developer. Just cd into the wine folder, uninstall the previous installation of Wine, clean out some cruft from your previous compile, and update your local tree from Wine's codebase:

$ cd wine
$ sudo make uninstall
$ make clean
$ git pull

It may take a while depending on how long it's been since your last sync with Wine's codebase, but should still be way faster than downloading the entire tree. You can then proceed to update your local tree (see above) & compile the latest Wine from source.

Uninstalling Wine depends on the method of installation that was used to install Wine.

Method 1: Uninstalling using from Wine's repository

If you chose to install from Wine's repository, then uninstalling is as simple as the following:

$ sudo apt-get --purge remove wine

Method 2: Uninstalling from source

For those who installed Wine from source, I hope you kept that wine folder intact since your install. To remove, do the following:

$ sudo make uninstall

Then, delete the wine folder to get rid of Wine completely from your system.

References: