Operating system virtualization is popular technology these days. People run different operating systems on top of their existing ones not only for experimental purposes but also for production use. Many different virtualization systems exist. VMware, which runs on both Windows and Linux, may be the best-known proprietary example. It can host many operating systems from Win98 to FreeBSD and different flavors of GNU/Linux.
Of course, the free and open source software communities have their own virtualization software. Bochs follows the example of VMware, while Plex86 also does CPU virtualization.
For cases in which you'd rather run different versions of Linux atop an existing Linux installation, User-mode Linux may be a better answer. It operates at the kernel level and can supply a very stable, try-and-see sandbox for different Linux kernels, with almost no virtualization penalty. Because of this, more and more developers use User-mode Linux to test new kernels, drivers, etc.
What if you want to run GNU/Linux atop a Windows platform or try Linux without installing it on a partition itself, thereby preserving — and not even rebooting — your Windows system? Don't worry; VMware and Virtual PC are not your only choices. A new free software project called coLinux, or Cooperative Linux, lets you do nearly everything User-mode Linux does on Windows 2000 or XP.
To start, download two packages from the coLinux site. One must be the binary coLinux system. The other is your actual file system, a pre-installed GNU/Linux system. At the current moment you have two choices for the file system -- Debian or Gentoo. The project's Wiki site has instructions for making a Togo Linux install also. We'll use the Debian system for the purpose of this article.
|Linux/Unix System Administration Certification -- Would you like to polish your system administration skills online and receive credit from the University of Illinois? Learn how to administer Linux/Unix systems and gain real experience with a root access account. The four-course series covers the Unix file system, networking, Unix services, and scripting. It's all at the O'Reilly Learning Lab.|
With version 0.6, installation is easier than ever. Download and run coLinux-0.6.0.exe. The tap device and everything else will be taken care of. For the sake of simplicity, install to C:\colinux.
If you are using an earlier version, take the following steps manually.
Now that you have downloaded these files, extract them to some directory, preferably C:\colinux if you do not want to make many changes after the install. The file system (18MB) will decompress to 1Gb. Do not worry about that, just be sure that you have enough free space.
If you are using Windows 2000 as your base system, after extracting everything go to Settings -> Control Panel -> Add/Remove hardware -> Add/Troubleshoot Device -> Add a new device -> No -> Network Adapters -> Have Disk -> (Go to TAP-Win32 directory chose OemWin2k -> Next -> Next -> Finish.
If you are using Windows XP this process is a bit different: Control panel -> Add hardware -> Yes -> Add a new hardware device -> Install from a list (Advanced) -> Network Adapters -> Have Disk -> Chose OemWin2k driver (from where you unzipped it) -> Next -> Next, and Finish.
In version 0.54, there was a syntax error in default.config.xml where the root file system's
<block_device> tag remained open. Change the root file system
to refer to your file of choice or put the name of the extracted 1GB image
file's name into
root_fs. Then, close the tag by adding
before the next
<block_device> tag. This does not apply to
You can make other changes to the config file. For example, you can change
the amount of RAM with the
<memory> tag or choose your swap
file. Be cautious, though.
If everything is ready, you can launch coLinux from the
colinux-daemon. This will open a console window and boot your
Linux system. You should see something like Figure 1.
Figure 1. coLinux booting.
After booting, another window named "Cooperative Linux console" will open. This will be your virtual Linux monitor. Here you will see a normal Linux system booting, as shown in Figure 2.
Figure 2. coLinux console booting.
You're ready to go when it says:
Debian GNU/Linux 3.0 colinux tty1 colinux login:
Log in as
root with no password (remember you are still on
Windows ;). You'll be in the loop file system, still just a single file on your
Windows drive. If you use
df -kh to see used space, you'll see
the following lines
Filesystem Size Used Avail Use% Mounted on /dev/cobd0 1008M 91M 865M %10 /
This is a very basic system with just enough installed to use networking.
coLinux networking is as gentle as its console. coLinux uses the Tap32 driver to connect to the network as if it were a completely different computer.
There are mainly two different ways to connect this virtual computer to the network. One is through Network Address Translation (NAT). The other is by setting up a Native/Bridged network. For the sake of simplicity we will use the first method.
First, install the TAP-Win32 driver as explained above. Then, configure Connection Sharing on the Windows box.
For Windows 2000, navigate through Control Panel -> Network and Dialup Connections -> Select the network adapter for sharing -> Properties -> Sharing Tab -> Enable Internet connection sharing -> use the name of the TAP-Win32 adapter - > Ok.
With Windows XP, instead follow Control Panel -> Network Connections -> Select the network adapter for sharing -> Properties -> Advanced Tab -> Allow other network users -> Use TAP-Win32 Adapter -> Ok.
Your coLinux session needs an IP address on the same network as the network
interface that serves as your gateway. If you have installed Debian
then check the values in the file
vi as your editor with this image. Be warned that the console updates slowly sometimes, so you may see things that
really aren't there.)
Here's the default configuration. They're also compatible with the default Windows Connection sharing settings which make the IP of your TAP-Win32 Adapter 192.168.0.1:
ifconfig eth0 inet static address 192.168.0.40 gateway 192.168.0.1 netmask 255.255.255.0
Now change the
/etc/resolv.conf file. This stores the addresses
of your DNS servers. Put in the correct values for your network.
Finally, restart your Ethernet interface to activate the changes:
# ifdown eth0 # ifup eth0
If you prefer to make your changes the quick and dirty way, the following commands also work:
# ifconfig eth0 192.168.0.40 netmask 255.255.255.0 # route add default gw 192.168.0.1 # echo "nameserver [nameserver_ip] > /etc/resolv.conf
Let's now test the connection.
ping is always a good place to
colinux:~# ping www.sun.com PING www.sun.com (188.8.131.52) 56 data bytes ---www.sun.com ping statistics ---
Depending on the configuration of your LAN and firewall, you may not receive
an answer to this ping request. The name resolution of
184.108.40.206 means that you've
reached DNS, so you've reached the Internet. You'll probably reach the Web and
other services correctly.
With a nice, networked Debian GNU/Linux box on top of a Windows computer,
it's time to experiment. First let's see what we have installed. Debian's
dpkg tool comes in handy:
$ dpkg --get-selections | more
Here are the basic installed programs in several categories.
nvi will have
to suffice for most of users. (Sorry, Church of Emacs!) If you are not into
the arcane knowledge of
Programming. As for the basics, you can use
Pager. Well, there's
more, but unfortunately
Networking. Your options are limited. There's
ping, but unfortunately no
mtr. There's also
iptables, for basic needs.
There are very few programs included, which is why it's a base system that takes up only 93Mb on disk. Don't forget that you are using Debian GNU/Linux, one of the most easily updateable systems.
The base system configuration makes it easy to add the programs you want. First, update the list of installable packages:
# apt-get update
Then, you can install any package by name with the command:
# apt-get install package_name
Of course, if you're not familiar with the Debian packaging system (of world domination), you may not know which packages you want. Never fear! You can search for packages with:
# apt-cache search search phrase
You can also read package descriptions with:
# apt-cache show package_name
For more information, see Davor Ocelic's excellent Debian Tutorial.
Now that you have a base GNU/Linux box that you can upgrade or on which you can install new software, you can experiment with anything you like.
The coLinux project is a still in the beta stage, though it can already boot Knoppix and do more complicated tasks. There still are glitches on the console; the screen does not update well in full screen mode, there's no command line history editing, and I could not find a way to scroll back in the console window, for example.
Possible uses include using it for networking, both experimental and for production. You can set up a coLinux network and try IDS software on it. You can extend your Windows box with GNU/Linux abilities (like Cygwin), or experiment with different Linux kernels, though UML may be a better option.
All in all, this is a very interesting concept. I predict that it will be a very good alternative to other Linux virtualization solutions in the very near future.
coLinux Wiki. This is probably your main source of coLinux info. It was my best reference while setting up coLinux.
Rute User's Tutorial and Exposition, an all-round GNU/Linux book even suitable for beginners.
Davor Ocelic's Hands-on Guide to the Debian GNU Operating System. If you are familiar with GNU/Linux but not Debian, this Guide will teach you lots.
A very good in-depth Debian Reference Guide.
KIVILCIM Hindistan works as a full time computer security consultant with a CISSP, using Linux and Free Software as weapons of choice.
Return to LinuxDevCenter.com.
Copyright © 2009 O'Reilly Media, Inc.