LINUX 101:: Run Windows Applications With Wine
LINUX 101:: Run Windows Applications With Wine
Q
uestion: what do you call a program that runs from the latter operating system. It’s completely free
WHY DO THIS? software designed for a different platform? An software – you don’t need a licence from Microsoft to
• Run legacy Windows emulator, right? Well, the name Wine comes use it – and it’s capable of running a wide range of
apps without rebooting.
from “Wine Is Not an Emulator” – which is one of programs. Not all of them, mind you, and very recent
• Create multiple
configurations for better those recursive acronyms that are so loved in the software can have problems. But some major
compatibility. FOSS world. But given that Wine lets you run Windows applications like Microsoft Office 2010 work well
• Help Windows users software on your Linux installation, why is it not an enough for daily use.
move over to Free emulator? Essentially, Wine acts as a compatibility So if you’re still dual-booting between Linux and
Software.
layer that translates Windows system calls to their Windows, and would rather spend more time in the
Linux equivalents, and it doesn’t actually emulate a former, here we’ll show you how to use Wine and
complete Windows PC, with its CPU, graphics card (hopefully) run your favourite Windows apps without
and so forth. rebooting. Or if you’re a full-time Linux user and don’t
Anyway, with that naming confusion out of the way, give a hoot about Windows, you can still use this
let’s focus on the software itself. Wine is a godsend for guide when you’re helping others make the transition
many Linux users who’ve made the transition from to Linux, set up Wine for them and demonstrate the
Windows, but still need to run the occasional program awesome power of free software.
1 GETTING STARTED
Wine is included in almost every major distro’s www.winehq.org. After you’ve got it installed, find a
repositories, so find it in your package manager or use simple, standalone Windows program to test; in our
your usual command-line tools to install it (eg sudo case we’re going to use the rather cool Notepad++ text
Here’s our first app runing
apt-get install wine on Ubuntu-based distros). We’re editor available from http://notepad-plus-plus.org.
on Wine – Notepad++. It’s a
simple program and using Arch Linux for this tutorial – but the commands This program exists as a single .exe file and doesn’t
therefore has few are the same across other distros. If you want the have a ton of complicated dependencies, so it’s the
compatibility issues with latest and greatest version and are happy compiling perfect type of program to kick tires of a new Wine
Wine. software from its source code, you can get it from installation.
Go to the Downloads section, then grab the
“minimalist package” and save it to your home
directory. This is in 7-zip format, so install the tool to
extract that in your distro’s package manager (it
should be provided in the package p7zip). Then open
a terminal and enter:
7z x -onpp npp.6.6.9.bin.minimalist.7z
cd npp
Here we’re extracting the download into a new npp
directory – if there’s a newer version of Notepad++ by
the time you read this, change the version number
accordingly. We then switch into the directory, and if
you enter ls, you’ll see that there’s a file there called
notepad++.exe. Let’s run it!
wine notepad++.exe
You may be prompted to install Mono and Gecko
packages; these aren’t important for now, so just click
Cancel in the dialog boxes that appear. And after a few
moments, you’ll see Notepad++, a Windows program,
in all its glory on your Linux desktop. Not bad – it’s as
simple as that!
88 www.linuxvoice.com
WINE TUTORIAL
Well, for small programs it’s simple; we’ll get to the are Wine’s own implementations of core Windows
more complicated setups later. For now, try exploring libraries – and again, they’re fully open source.
the program. As mentioned, Wine translates every Now, they’re not always as feature-complete as the
Windows system and library call that the program original Windows versions, so in some cases you can
makes into a Linux equivalent. So if you save a file copy DLLs from a real Windows installation into this
from Notepad++, the program calls Windows’ file directory, to improve compatibility with certain
saving routine, Wine intercepts it, and forwards on the programs. The only ones you must never overwrite
request to the Linux equivalent. When Notepad++ are kernel32.dll, gdi32.dll, user32.dll, and ntdll.dll
wants to draw something on the screen, it makes – you can only use the Wine versions of these.
requests to Windows libraries – and Wine has its own As an aside, the
versions of these, which then talk to the X server on ReactOS project
Linux. It’s very cool technology. (www.reactos.org), “Wine translates every system
Two worlds collide
which aims to create an
open source Windows-
call that an application makes
Of course, Wine can’t magically make some of the compatible operating into a Linux equivalent.”
differences between Linux and Windows disappear. system, uses many Wine
Go to File > Open in Notepad++, for instance, and DLLs. The underlying
select My Computer from the “Look in” list. You’ll see structure of ReactOS is very different to Linux and
C:, D: and Z: drives – but they make no sense in the Unix, as it aims to be compatible with Windows drives
Linux world. Well, Wine maps them to different as well as software, but there’s a decent amount of
Adobe has dropped
locations in your filesystem. The Z: drive is mapped to code-flow between ReactOS and Wine. We’ve been support for Reader on
the root directory (/), which is the base of everything in following ReactOS for many years and it’s making Linux, but thanks to Wine,
a Linux/Unix system. So you can use that drive to go slow but steady progress – what Microsoft’s lawyers you can get some Windows
to your home directory in /home and access your think about it, though, remains to be seen… versions running.
personal files – or use the My Documents shortcut.
But where does C: point to? If you click into it, you’ll
see some familiar folders from a Windows installation:
Program files, windows and so forth. These were
created when you first ran Wine, so let’s explore them
in more depth. They’re located in .wine/drive_c in your
home directory, so close Notepad++ and switch into
that directory like so:
cd ~/.wine/drive_c
Enter ls and you’ll see those folders again. Switch
into the windows directory with cd windows and run
ls again – this time, you’ll notice some common tools
like Regedit. Basically, Wine has created a very minimal
Windows installation in your home directory,
comprised of fully open source software, of course.
So you can run the included tools like so:
wine regedit
(Note that you can omit the .exe.) This looks just
like the real Windows registry editor, but go to Help >
About and you’ll see that it’s a tool written by the Wine
developers. Back in the terminal, if you head into the
windows/system32 directory (and syswow64 on
64-bit installations), you’ll see a bunch of DLLs. These
www.linuxvoice.com 89
TUTORIAL WINE
90 www.linuxvoice.com
WINE TUTORIAL
www.linuxvoice.com 91