Some of us still need to use Windows desktops. Your work environment might call for it; your family may only have a Windows machine at home; or perhaps you just plain prefer Windows as a desktop operating system. And that’s OK. But there are situations when you need Linux when you’re running Windows.
There is at least one commercial product on the market, EMC’s VMWare Workstation 5 For Windows, which does just that and does a great job, albeit for $200 per copy. If you’re willing to spend the extra money to run any Linux distribution that you want within Windows, it’s a great application to have.
But for those of us who are cheapskates, there’s an alternative: Cooperative Linux, or CoLinux for short. CoLinux is an open source project that allows you to run a specially-modified Linux kernel as a Windows application without having to use virtualization software. There’s a catch, though: you can’t just run Fedora Core or any old Linux distribution out of the box. Instead, you have to download system images of modified versions of distributions that have been specifically altered to run on CoLinux.
But thankfully, the CoLinux community is pretty active and several of the popular distros, such as Debian, Fedora, and Knoppix have been ported. Keep in mind that these aren’t the latest and greatest versions — they might be a revision or so behind. Also keep in mind that CoLinux is considered to be very much a work in progress, so it’s not a highly-polished product like VMware, and it requires a number of manual configuration steps to get working correctly. Still, for free Linux running within Windows, CoLinux can’t be beat. And once you get everything working, your patience is richly rewarded.
Downloading and Installing CoLinux
You can download the CoLinux software at the CoLinux web site, http://www.colinux.org
. Because CoLinux is constantly being improved and actively developed, it’s best to download a recent “Developer Snapshot” at http://www.colinux.org/snapshots/
. At the time of this writing, 0.6.3-pre13
was the current version.
Once you’ve downloaded a copy, simply run the self-extracting installation program by double-clicking on the file stable-coLinux-20050524.exe (or newer version). After you accept the license agreement, choose all of the components, and then click Next. On the following screen, choose where you want to install CoLinux. If you don’t like stuff digging into Program Files, choose something like C:\colinux.
The next screen demonstrates how to download the WinPcap
bridged networking DLLs. This step has to be done manually, since CoLinux does not distribute these DLLs with its installation program. Go to WinPcap web site at http://www.winpcap.org/
, go to the Download section, and download the self-extracting executable file and run it. You can then continue with the CoLinux installation.
The next Colinux installation screen asks you what Linux distribution image you want to download. For first time users, download the Debian
image. The Debian image is a 18 MB, compressed .bz2
file that you must unpack before using. (A good freeware program that can unpack bzip
files is TugZIP,
found at http://www.tugzip.com
. It’s also very good for general Windows archiving tasks.)
After downloading the Debian image, the CoLinux installer completes. leaving you with a number of files unpacked in the c:\colinux directory.
The next thing to do is unpack the Debian image that’s going to be used for the root filesystem. If you downloaded TugZIP, use it to open the .bz2 file and extract it to a convenient location, such as c:\colinux\debian. Once it’s been unpacked, you should have a large 1 GB file named Debian-3.0r2.ext3-mit-backports.1gb (or something similar). Rename that to debian.1gb, because it’s easier to deal with that filename in the next step.
Next, copy the default.colinux.xml file in c:\colinux to colinux.xml. (You’re about to make a number of changes to the file, so keep a backup just in case of catastrophe.) Pull up Windows Notepad and edit colinux.xml. Here’s what the file looks like, sans comments:
<?xml version="1.0" encoding="UTF-8" ?>
<block_device index="0" path="\DosDevices\c:\colinux\debian\debian.1gb"
<initrd path="initrd.gz" />
<image path="vmlinux" />
<memory size="512" />
<network index="0" type="bridged" name="Local Area Connection" />
The first parameter, block_device, needs to be changed from the default to point to your c:\colinux\debian\debian.1gb file. In the part that references path=, use the same pathing convention starting with \DosDevices\ and then the regular drive path, pointing to c:\colinux\debian\debian.1gb as above.
The second parameter that should be changed is memory size=. Change this to a number that is less than the amount of real system memory on your Windows machine. For example, if you have 1 GB of RAM on your PC, use 512 MB, if you are going to run graphical apps. If you’re going to just use console apps, 128 MB or 256 MB is probably fine.
The last parameter that needs to be changed is network. CoLinux supports bridged as well as “tap” connections. In a bridged connection, CoLinux acts like it’s another machine physically connected on your TCP/IP network and requests its own unique TCP/IP address. With tap, you are tapping into the IP address and using network address translation. Bridged connections may be preferable to you, because you can easily access CoLinux from other PC’s on the network via SSH and VNC connections, and its useful if you are going to be running other network services on your CoLinux that need to be accessed from other machines, such as Apache or MySQL.
If you choose “bridged” as opposed to “tap”, you’ll need to fill out the name= parameter. You can determine the name of your network adapter by right-clicking on “My Network Places” on the Windows desktop, and choosing “Properties”. On most machines, the first network connection is called Local Area Connection, so fill in the name= parameter as name=”Local Area Connection”. (Also see the sidebar” Special Considerations” if you have a Broadcom or Intel integrated network interface card.)
Next, create a batch file in your c:\colinux directory called colinux.cmd. Pull up Notepad again, and add the following line to colinux.cmd:
colinux-daemon.exe –t nt –c colinux.xml
When colinux.cmd is executed, it runs the CoLinux daemon, parses the colinux.xml file, and starts the CoLinux kernel and virtual console.
Next, right-click on the Windows desktop, choose “New, Shortcut,” choose “Browse, My Computer, Local Disk (C:), \colinux, colinux.cmd.” This should put a “Shortcut to colinux.cmd” link on your desktop. If you right click on that shortcut, you can change the icon properties to call it something more useful, like “CoLinux (Debian) ”.
At this point, if you’ve done everything correctly, you should be able to double-click on that shortcut, and the CoLinux virtual console should fire up.
Logging In and Altering Network Settings
With CoLinux running, go ahead and log into your Debian system. If your CoLinux console just fired up, you should see a CoLinux login: prompt. Sign in as root, with password “root.”
Once you’re logged in, edit your /etc/network/interfaces file (the nano editor is built into the default CoLinux Debian image for those of you vi haters) so you can talk to the Internet and your Windows machine can talk back to CoLinux. Here is the relevant section you need to pay attention to:
iface eth0 inet static
Here, 192.168.0.40 is an unused static address on the LAN (don’t use the same address as your PC!) and netmask and gateway are set appropriately. You can derive the latter settings if you don’t know them offhand by opening a Windows command prompt and issuing ipconfig /all. Sample output is shown in Figure One.
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Broadcom NetXtreme Gigabit Ethernet
Physical Address. . . . . . . . . : 00-0F-1F-C8-C2-6D
Dhcp Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : No
IP Address. . . . . . . . . . . . : 192.168.0.102
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.254
DHCP Server . . . . . . . . . . . : 192.168.0.254
DNS Servers . . . . . . . . . . . : 188.8.131.52
Lease Obtained. . . . . . . . . . : Thursday, June 16, 2005 1:21:50 PM
Lease Expires . . . . . . . . . . : Friday, June 17, 2005 1:21:50 PM
If you’re using a static IP, also edit your /etc/resolv.conf file and add the DNS nameservers for your LAN. A resolv.conf looks like this:
However, if you’re a road warrior — perhaps you’re using CoLinux on your laptop — your /etc/network/interfaces should look like this:
iface eth0 inet dhcp
On a DHCP configuration, you won’t need the address, netmask, and gateway settings, but make sure you remember what your IP is at any given time by typing ifconfig eth0 at the CoLinux console.
Once your /etc/network/interfaces and /etc/resolv.conf have been modified and saved, issue the following command at the CoLinux console:
# ifdown eth0
# ifup eth0
You should now be able to ping outside Internet hostnames, such as as linux-mag.com, google.com, and so on. Your CoLinux is now fully-networked, and should behave like a regular Debian Linux system.
Updating the Debian Package List and Installing Software
To start using applications, first update the Debian package list. Issue the following command at the CoLinux console:
# apt-get update
Next, install support for graphical applications:
# apt-get install xserver-xfree86
Answer “y” to all questions. Issuing the following command adds font support, a basic KDE, VNC, and the OpenSSH server:
# apt-get install xfonts-base \
xfonts-75dpi kdebase konsole \
If you want to run graphical Linux applications in CoLinux, you must run the VNC Server daemon. Issue the following command from the console:
# vncserver –geometry 1024x768 –depth 16
Note that the 1024×768 part can alternatively be 800×600 or 640×480, if you want a smaller virtual desktop. After issuing the vncserver command, you should get output that looks like this:
New ’X’ desktop is colinux:1
Starting applications specified in /etc/X11/Xsession
Log file is /root/.vnc/colinux:1.log
Remember, you must issue the vncserver command every time you re-start CoLinux.
The very first time you run vncserver, you’ll be asked to enter a password; use something you can remember easily. If by chance you forget it, simply delete the contents of /root/.vnc/ and start the vncserver again. To change your password, use the vncpasswd command from the console.
To connect to your VNC server from your Windows machine (or from another remote machine) go to http://www.realvnc.com
and download the free VNC Viewer
application. Run the application and when prompted, enter the IP address of your CoLinux machine with a :1
at the end. Enter the vncserver
password when prompted.
If you’ve done everything correctly, you should be presented with a KDE desktop running in a window on your Windows machine.
Remoting into CoLinux using SSH and WinSCP
If you installed the SSH package along with vncserver and KDE, you should now have the OpenSSH daemon (sshd) running within CoLinux. You can now ssh (secure shell) to your CoLinux IP address using another Linux or Unix machine (like your MacOS X machine) and execute command-line applications. If you’re going to use your CoLinux primarily for command line apps, this is probably your best bet.
For transferring files back and forth between your Windows file system and your CoLinux filesystem, try WinSCP,
which can be downloaded from http://winscp.net
. WinSCP is essentially a graphical, FTP-
like program that uses the SSH transfer protocol over the secure shell port to transfer files in an encrypted fashion. Like ssh,
you’ll need to know the IP address of your CoLinux system when transferring files or initiating a connection.
Getting More out of CoLinux
As you would expect, there’s a lot more to CoLinux than what’s been shown here. Check out the CoLinux “wiki” at http://wiki.colinux.org
. There’s a vast amount of material there, including instructions on how to “grow” your CoLinux filesystem if 1 GB of space is too small for your pet Debian system. There’s also a #colinux
IRC chat channel on irc.oftc.net,
as well as a mailing list hosted on SourceForge, for those of you looking to interface with your fellow CoLinux users.
An interesting alternative to the “official” CoLinux build is TopologiLinux
), a tweaked, semi-polished version of CoLinux that includes a modified version of Slackware, and it installs in a few easy steps.
Jason Perlow is the very definition of power user. You can reach him at
Fatal error: Call to undefined function aa_author_bios() in /opt/apache/dms/b2b/linux-mag.com/site/www/htdocs/wp-content/themes/linuxmag/single.php on line 62