Running Linux on Windows Like Normal Programs

Using small Linux distro like Puppy Linux and open source emulator like QEMU, it is possible to run and stop Linux like normal windows programs. By creating virtual hard disks and using software like WinImage you can actually transfer data between Linux and Window. You can also create a virtual network between Windows and the guest OS for sharing and transferring files. And not to forget SAMBA in this context.

Screenshot of Puppy Linux

About Puppy Linux

1. Its small size 60-70 MB with full fledged GUI.
2. Rich collection of software like text editors, Mozilla, multimedia players ,ghostscript and support for networking.
3. Nice GUI tools for performing common and configuration tasks. This is something which windows users are very used to.
4. It even has a small web server and Tcl/Tk.

About QEMU

QEMU is an open source and fast emulator. The best thing about it is size (only 6MB).Though for now windows port is in alpha stage, it rocks. I like its simple command line interface for starting.

Getting Started

First download QEMU for Windows (Alpha)and unzip it to some directory.QEMU comes with a demonstration Linux distro image. Open the qemu-win.bat file, you see the following:

REM Start qemu on windows.
@ECHO OFF
START qemu.exe -L . -m 128 -hda linux.img -enable-audio -localtime
CLS
EXIT

Now download puppy Linux from any of its sites. I downloaded puppy-1.0.3-mozilla.iso which is about 62 MB in size. It has Mozilla as default browser. Copy it to same directory as qemu-win.bat file. Modify the qemu-win.bat file to:

REM Start qemu on windows.
@ECHO OFF START qemu.exe -L . -m 128 -hda linux.img -cdrom puppy-1.0.3-mozilla.iso -enable-audio -localtime -boot d -user-net
CLS
EXIT

Hey! you have a full fledged Linux system running inside windows.

Starting Network

At the Puppy Linux shell type the following:

#dhcpcd eth0
#ifconfig

Get the address for eth0 of emulator.I always get the address for eth0 as 10.0.2.15 .On your windows machine you can get your ip using ipconfig (say it is xxx.xxx.xxx.xxx).From Puppy Linux shell type:

#ping xxx.xxx.xxx.xxx

If it is successful, start Mozilla and point it to some site on your IIS web server (Assuming you have one or else install one). In the screen shot you can see a site hosted on IIS server being accessed with Puppy Linux running Mozilla. By enabling directory browsing of the site you can even share files between both operating systems. Below is screenshot of Mozilla on Puppy displaying a page hosted by IIS on Windows 2003.

Enabling Sound

Enabling sound is also very easy.QEMU supports SB16 emulation .This is something I like about running Linux on QEMU , no problems with sound card .But Puppy could not detect sound card by itself. I used help documentation accompanying with puppy was of great help. Make sure you started QEMU with ‘audio’ option.

#cd /lib/modules/2.4.27/sound
#ls
#modprobe -v sb
#lsmod

You should see following entries in output of lsmod

sb
sb\_lib
soundcore

I just put a simple audio file on my web server and pointed Mozilla to the site. From directory listing you can save the file and/or play it using gxine. Below is screenshot showing gxine playing a wave file. The sound may be quite squeaky though ;-)

Transferring Data using Virtual Hard disk Images

If you are a samba fan then you should definitely try installing and running samba with QEMU+PuppyLinux. Another nice way of sharing data between host and guest OS is using ‘disk images’. QEMU comes with a utility qemu-win.exe which can convert different types and sized virtual hard disks for use with Puppy Linux .I could successfully create qcow and raw formatted disk images. The advantage of qcow format is its small size which grows as you write to it. The advantage of raw format is that you can format it and use with a program like WinImage.Now comes the question of accessing this data .WinImage is an excellent program for this. It can even write(inject) files into a (raw formatted) virtual image files with FAT. Then I used FreeDOS floppy image and QEMU to format it to FAT16. Now you can use such a hardisk as ‘hda’ or ‘hdb’ of QEMU , mount it on puppy Linux and save data on it.

Doing More interesting things!

There are many more interesting things still you can try out. Firstly you can try out samba and experiment using OpenVPN(QEMU TAP version). There are many additional packages called dot-pups available for Pupply Linux here.I think combination of QEMU and Puppy Linux is just the perfect combination for small Linux that runs inside windows like normal programs. Moreover the executables for QEMU and Puppy Linux ISO occupy just around 70 MB of disk space and give you a full fledged Linux system with GUI and networking. This combination I think will be very helpful for those interesting in making small Linux distro ,students and hackers.

Puppy Linux download
http://distro.ibiblio.org/pub/linux/distributions/puppylinux/

Puppy DotPups
http://www.goosee.com/puppy/wikka/DotPups

WinImage
http://www.winimage.com/download.htm

Puppy Home Site
http://www.goosee.com/puppy

QEMU for Windows TAP patch
http://www.h7.dion.ne.jp/~qemu-win/

QEMU with OpenVPN
http://www.h7.dion.ne.jp/~qemu-win/TapWin32-en.html