Running GNU/Linux on Windows

Odd Couple


Sometimes dual booting from Windows to Linux and back again isn't the answer. We'll show you how to run Linux under Windows.

By Bruce Byfield

KonstantinosKokkinis, Fotolia

At first, running GNU/Linux on Windows might seem a perverse thing to do. The two operating systems differ in filesystems, directory hierarchies, shells, graphical interfaces, libraries, and just about everything else you can name. Why even try?

If you are a developer, the answer may be the sheer challenge. But, even if you are a task-oriented user, you still might find running GNU/Linux on Windows useful. You might want to run a favorite program or two that has not been ported to Windows yet or be able to run a GNU/Linux program on your network without having to dual boot. Perhaps you dislike Windows and want a familiar environment in which to work. Or, maybe you want an easy way to show GNU/Linux to friends and family without having to endure the glacial slowness of a Live CD or the effort of setting up a dual-boot system.

For all these reasons, developers have produced several methods of running GNU/Linux under Windows. The bad news is that most of these methods are still in development. However, the good news is that Windows 7 is enough like its predecessors that it has not slowed most of the efforts to run GNU/Linux in Windows by more than a couple of weeks.

Cygwin

The earliest effort to run a Unix-like system under Windows is Cygwin [1]. Originally developed by Cygnus Solutions and now maintained by Red Hat, Cygwin is not technically GNU/Linux. However, the site describes it as "Linux-like," and anyone who has used GNU/Linux will find its collection of GNU tools and other standard pieces of free software immediately familiar. It even provides some variety, offering KDE, Gnome, and a variety of window managers for graphical interfaces for 32-bit Windows.

Although Cygwin's usability has improved during the 14 years of the project, it still lags behind other solutions in usability. For instance, although the Cygwin installer now includes a graphical wizard, its package selection page can only be described as primitive. By default, it installs only a virtual terminal, requiring Cygwin/X [2], an X server designed for Windows, for a graphical interface. Additionally, the available packages show a strong inclination towards text-based applications, with TeX being offered rather than OpenOffice.org for word processing, and Pine rather than KMail for reading email. In many ways, using Cygwin is a step back to the free software of the late 1990s - which is exactly how many experienced sys admins like it (Figure 1).

Figure 1: Cygwin is the old solution for running Linux under Windows, but its default orientation to text-based apps means that it is not for everybody.

For everyone else, online help is readily available for such routine tasks. In fact, online help is the quickest way to learn how to mount Windows paths as filesystems or that you need to save the installer so that you can use it as a package manager. However, if you are willing to take the time to learn and configure Cygwin, its performance is as good as any of the other solutions mentioned here, and its robustness is superior. But if the effort is more than you are willing to make, then you can just delete Cygwin by manually removing its files and icons from your Windows system.

coLinux and Its Successors

Cooperative Linux (coLinux) [3] is a modification of User-Mode Linux. Like its predecessor, coLinux is a cooperative virtual machine - one that uses existing resources on the host system rather than its own.

coLinux requires the Windows Packet Capture Library (WinPcap) [4] to run. It also requires a root image, of which the project includes a wide variety, ranging from Arch Linux and Gentoo Deluxe to Debian and Ubuntu.

Each of these images has its own set of instruction notes that detail the steps to run and configure coLinux with it. If you want a graphical interface, you need to install Cygwin/X or Xming [5], two X servers that run under Windows and do further configuration. The instructions for all these steps are slightly opaque at first, becoming easier as you experiment. However, at version .75, coLinux is largely a hobbyist's means of running under Windows, rather than a means of doing any serious work (Figure 2).

Figure 2: Like Cygwin, coLinux is easy to install with just a command-line interface.

Earlier versions of Windows could run a more polished version of coLinux called Ulteo Virtual Desktop [6], not to be confused with Ulteo Open Virtual Machine. A fork of the KDE 3.x series, Ulteo Virtual Desktop installs a panel in the top middle of the desktop and includes a large selection of applications that use Windows' native widgets to run (Figure 3). The only drawbacks are that Ulteo Virtual Desktop is slow to load, because it consists of one large disk image, and that the default menu is modified to run the manufacturer's services and products.

Figure 3: Ulteo adds a KDE 3.5 panel to the Windows desktop. Unfortunately, it does not yet run in Windows 7.

Unfortunately, the last beta release was more than a year ago, and, in my testing, Ulteo Virtual Desktop installed but did not get beyond displaying its splash screen in Windows 7. That is a disappointment, because none of the other solutions mentioned here combine performance, ease of use, and integration into the Windows desktop as well as Ulteo Virtual Desktop.

Yet another off-shoot of coLinux is Portable Ubuntu Remix [7]. I was unable to run it successfully in Windows 7 - or any other version of Windows - but you might have better luck, depending on your hardware.

KDE on Windows

KDE on Windows [8] is a project to the port KDE applications and desktop to Windows. According to the site, the project supports Windows 2000, XP, 2003, and Vista, but it mostly works with Windows 7 as well. The project is still in development, so some applications are still in progress - notably Konsole - but, where applications do exist, they are generally stable and will start and run as fast as native Windows applications.

To install KDE on Windows, download and install the KDE Installer from Windows. This runs as a wizard, helping you select the repository from which your installation takes packages, the installation directory, and the packages to include. Some users might be at a loss as to which compiler to use, but chances are it won't matter much. The suggested defaults should serve you well.

With earlier editions of Windows, KDE on Windows' applications appeared in the Start menu and were searchable. However, integration is less complete in Windows 7. You can find applications at ~/KDE/bin in the menu, but the menu does not seem to locate the executable reliably; you have to rely on the mouseover to see file extensions. The easiest solution is to run a file manager instead.

The available applications are a well-rounded selection, ranging from utilities like Ark, Dolphin, and Konqueror to productivity software like KOffice and games like Klines and KGolf. If you use KDE regularly, however, you may miss applications like Amarok that have not yet been ported. Also, only a reduced set of System Settings is available.

The best thing about KDE on Windows is that if you run the command plasma-desktop, you can start a KDE desktop within Windows. The Windows toolbar will still be visible at the bottom of the screen, but, otherwise you will be working with the Plasma desktop rather than Windows' (Figure 4).

Figure 4: Start the Plasma desktop with KDE on Windows, and you can almost forget that you are using Windows.

KDE on Windows is still unfinished in places. If you find it unsuited to your needs, you can run the installer again to remove it from Windows 7 - although you will have to remove manually the directory structure and some of the files. However, if you continue to use it, supplementing it with a few other pieces of free software such as OpenOffice.org, you could almost forget that you were in Windows at all.

Wubi

The Windows Ubuntu Installer, better known as Wubi, installs a copy of Ubuntu within Windows, then presents you with a GRUB bootloader from which you can choose either Windows or Ubuntu.

To install Wubi, use either Ubuntu's alternative Live CD or download the installer while running Windows. Either way, Wubi opens in a window in which you set five installation settings: the installation drive, the installation size, the particular Ubuntu distribution (Ubuntu, Kubuntu, Xubuntu, or Mythbuntu), the install language, and a user password. Few of these settings should cause much problem. but, you might want to look up the different Ubuntu distributions if you are not sure how they differ. You should also remember that, by default, the account Wubi creates has the same name as your current Windows account.

After you provide this basic information, Wubi downloads the latest stable CD image for the Ubuntu flavor you chose, then readies the system to install. As you reboot, you have the choice of starting either Windows or Ubuntu, and starting Ubuntu begins the installation process (Figure 5). With a high-speed connection, the installation of Ubuntu should take 20-40 minutes.

Figure 5: With Wubi, you can choose between Windows and Ubuntu as you boot.

Once the installation process concludes, you can log into Ubuntu. Aside from the way it is installed, your copy of Ubuntu should have little to distinguish it from a normal installation. The installation contains the same applications as a regular install of the same version of Ubuntu. Possibly, you lose speed by running Ubuntu from an NTFS filesystem, but its greater efficiency and smaller memory footprint ensure that Ubuntu runs at least as fast as your Windows installation, and possibly faster. If you tire of Ubuntu, you can uninstall it from the Windows Control Center without any trouble - reboot, and even the bootloader is gone.

Overall, Wubi is a polished application, with an unconfusing interface. As long as you understand the options offered from the installer, you should have few problems with it. And, even if you don't understand the options, you can slip by unharmed simply by selecting the suggested defaults.

Virtualization

In the past few years, virtualization - the mimicking of a computer within another one - has become a popular way to run one operating system within another.

No version of Windows 7 comes with virtualization. However, you can download Windows Virtual PC and Windows XP Mode, a virtual machine included for applications that cannot run in Windows 7 [9]. Once you do, you can open them from the Start menu to configure them.

Although the documentation does not mention the fact, Internet rumor - as well as an unofficial support page for the previous version [10] - has it that Windows Virtual PC will install GNU/Linux as a guest operating system, sometimes with limitations. However, I was unable to do so on two machines with four or five different distributions, which suggests at the very least that the ability is erratic and probably hardware-dependent as well.

For this reason, you may prefer instead to select freeware such as VMware Player or VirtualBox, or free software such as Xen to run GNU/Linux via virtualization.

Of all these choices, probably the quickest to get up and running is VirtualBox. To set up virtualization in VirtualBox, you begin by using a wizard to create a virtual hard disk, assigning it the RAM and hard drive space you want it to use. An especially useful feature is a dynamically expanding hard disk, which only uses the memory it needs, up to the maximum that you specify. Each wizard page gives the information you need to make informed decisions.

After you create the hard disk, start it, and the First Run Wizard guides you through installing the operating system, either from an actual CD or DVD, or from a disk image on your hard drive (Figure 6). Once installation is complete, you can start the virtual machine from the list in the main VirtualBox window.

Figure 6: Preparing for the installation of the guest operating system with VirtualBox.

Assuming you have enough system resources - at least a gigabyte of RAM and about 20GB of hard drive space for each guest operating system - VirtualBox runs guest operating systems with next to no loss of performance. However, be prepared to spend some time tweaking the number of display colors and connections with the host operating system, as well as other aspects of the system.

Making a Choice

Which of these solutions should you try? That depends on what you hope to accomplish. Unless you want to tinker, Cygwin and coLinux are probably not for you. However, if you plan to work mainly at the command line, or only need to run one or two programs, you might consider them - especially Cygwin, which I have always found highly reliable.

Similarly, Wubi provides stability and performance, but requires a reboot to switch operating systems, which may not be convenient. All the same, if your purpose is to demonstrate GNU/Linux, or to share files easily between the two operating systems, then you might find it a quick and easy solution.

If Ulteo Virtual Desktop ran on Windows 7, it would probably be the best solution for most users. But, since it does not yet, KDE on Windows is probably the choice that will satisfy most people, providing they have no interest in Gnome applications. For others, virtualization may be the quickest and most versatile solution, but the memory resources required are just becoming standard on new desktop machines.

Still, whatever solution you choose, the technology is only going to get better. Running GNU/Linux under Windows might be perverse, imprudent, subversive - anything you like - but what's wonderful is that, despite the unlikelihood of the idea and the work that still needs to be done, it already works with surprisingly few limitations.

INFO
[1] Cygwin: http://www.cygwin.com/
[2] Cygwin/X: http://x.cygwin.com/
[3] coLinux: http://www.colinux.org/
[4] WinPcap: http://www.winpcap.org/
[5] Xming: http://www.straightrunning.com/XmingNotes/
[6] Ulteo Virtual Desktop: http://www.ulteo.com/home/en/download?autolang-en
[7] Portable Ubuntu Remix: http://portableubuntu.demonccc.com.ar/
[8] KDE on Windows: http://windows.kde.org/
[9] Windows 7: http://www.microsoft.com/windows/virtual-pc/download.aspx
[10] Windows Virtual PC: http://vpc.visualwin.com/