This is sometimes referred to as a "virtualization appliance".
Here's how to get started with Ubuntu and coLinux 0.7.1 on
a Pentium-based computer.
- Download and install coLinux from Source Forge
(http://sourceforge.net/projects/colinux/files.
- Download and install winpcap
(Home Page, Wikipedia) network packet capture driver.
You'll be prompted for this during
the coLinux install. It is OK to install it even if you don't need it.
- Download and unpack a disk image for a linux distribution in the colinux
directory on Source forge (e.g. ubuntu at
http://downloads.sourceforge.net/colinux/Ubuntu-6.06.1.ext3.1gb.bz2?modtime=1191438204&big_mirror=0.
You can also download more than one Linux distribution and create different
batch and configuration files for each one.
- Create a batch file
(Wikipedia)
called ubuntu.bat in the coLinux directory, and put one
command in it: colinux-daemon @ubuntu.conf. Make a short-cut to your
desktop for easy access and give it a nice icon if you wish. You'll need
to run the batch file to start coLinux.
You can choose whether or not you want the separate "FLTK" console window
(with the drop-down menus). Include the option "-t nt" if you want to use the batch
file window: you save yourself an extra open window but lose the menus.
Make a copy of the example configuration file, example.conf, and
name it ubuntu.conf and edit the settings in it to suit your computer.
Here's an example:
#
# This is an example for a configuration file that can
# be passed to colinux-daemon in this manner:
#
# colinux-daemon @example.conf
#
# Note that you can still prepend or append configuration and
# boot parameters before and after '@', or you can use more
# that one '@ to load several settings one after another.
#
# colinux-daemon @example.conf @overrider.conf mem=32
#
# Full list of config params is listed in colinux-daemon.txt.
# The default kernel
kernel=vmlinux
# File contains the root file system.
# Download and extract preconfigured file from SF "Images for 2.6".
# KB: This is essentially a ext3 disk image in a file format instead
# of a partition. You can create similar disks and mount them with
# dd / mkfs.
cobd0="c:\Program Files\coLinux\Ubuntu-6.06.1.ext3.1gb"
# Swap device, should be an empty file with 128..512MB (e.g. created with dd)
# Add "mkswap /dev/cobd1; swapon /dev/cobd1" to rc.local
# KB: I used the one included with the Gentoo coLinux image.
cobd1="c:\Program Files\coLinux\Gentoo-colinux-i686-2007-03-03\gentoo\linux-swap"
# Tell kernel the name of root device (mostly /dev/cobd0,
# /dev/cobd/0 on Gentoo)
# This parameter will be forward to Linux kernel.
root=/dev/cobd0
# Make Windows C: drive available (within limits) under coLinux
# You'll have to mount it with coLinux. e.g. make a /dosc and
# add to /etc/fstab:
# /dev/cofs0:Share /mnt/windows cofs defaults 0 0
# Or mount manually with "mount -t cofs 0 /mnt/dosc"
cofs0=c:\
# Additional kernel parameters (ro = rootfs mount read only)
ro
# Initrd installs modules into the root file system.
# Need only on first boot.
initrd=initrd.gz
# Maximal physical memory for linux guest# Maximal physical memory for linux guest
#mem=64
mem=384
# Slirp for internet connection (outgoing)
# Inside running coLinux configure eth0 with this static settings:
# ipaddress 10.0.2.15 broadcast 10.0.2.255 netmask 255.255.255.0
# gateway 10.0.2.2 nameserver 10.0.2.3
# KB: slirp works out of the box but you can only see out, not in.
# Also, remember to configure resolv.conf.
eth0=slirp
# Tuntap as private network between guest and host on second linux device
#eth1=tuntap
# FORMAT: connection driver, ipconfig connection [, optional MAC address]
# eth0=pcap-bridge,"Loopback" - connect only to Windows XP
# KB instructions:
# 1. Rename the colinux tap network connection to Colinux Tap
# 2. Change "Local Area Connection" (or whatever connection is the real one)
# to Advanced/Share. Record IP (probably 192.168.0.1).
# 3. Enter that IP into the Colinux TAP TCP/IP setup. Ignore gateway/DNS
# as real connection will take care of those.
# Still didn't get it to work.
#eth0=pcap-bridge,"Colinux TAP",,
eth1=pcap-bridge,"Local Area Connection",,
# Setup for serial device
#ttys0=COM1,"BAUD=115200 PARITY=n DATA=8 STOP=1 dtr=on rts=on"
# Run an application on colinux start (Sample Xming, a Xserver)
#exec0=C:\Programs\Xming\Xming.exe,":0 -clipboard -multiwindow -ac"
Alternatively, an xml-based configuration file can be loaded with "-c" but not
all options are supported.
This is an explanation of some of the options:
- Adjust how much memory will be taken from Windows on your computer for coLinux
The default is 64 MB which is about the minimum to get Linux to boot. The
maximum of 512 MB. Using too much will make Windows struggle; using too
little will make Linux struggle. Remember that you can add swap space
afterwards.
- Make sure the root file image path (cobd0) is correct,
pointing to the root Ubuntu image file you downloaded.
- Create a swap file. Some Linux distributions for coLinux come with swap files
included (I grabbed mine from Gen-Too when I tried it out). However, you
can create your own with the Linux dd / mkswap commands (within coLinux or on
another Linux machine). Put the Windows path to the swap file path in cobd1.
- Start coLinux. If all is well, you should get a shell login prompt. The
usual login/password is "root/root". Make sure your swap file is mounted
by checking the available memory with Linux free command.
If you see the message "Cannot open root device cobd0", check the
path to cobd0 in the config file.
- Networking
Configuring networking for coLinux can be difficult because of the lack of
current documentation and the reliance on third-party tools. There are
three networking methods: slirp (runs "out of the box" but only allows you
to connect out of coLinux, WinPTap (makes coLinux appear to be a separate
computer on your network, but has limitations) and tuntap (makes coLinux
visible to Windows on the same machine but not to other computes...
http://vtun.sourceforge.net/tun/). It is possible to run these methods simultaneously
through different network devices in coLinux (e.g. eth0 for slirp, eth1 for
tuntap, etc.).
The additional numbers on slirp enable port-forwarding from Windows TCP/IP
ports to coLinux.
Edit /etc/resolv.conf and add the nameservers. slirp (eth0) should work
immediately.
Get your IP number with ifconfig.
# / Etc / hosts
127.0.0.1 localhost
192.168.0.190 colinux
ping -c 1 ubuntu to make sure it works
# The loopback interface
auto lo iface lo inet loopback
#
# The first network card - this entry was created during the installation Debian
# (network, broadcast and gateway are optional)
auto eth0 iface eth0 inet static address 192.168.0.190 use the IP address of COLINU
X netmask 255.255.255.0 gateway 192.168.0.210 use the gateway IP address
Use ifconfig to make sure eth0 is up.
Test with "ping -c 1 www.yahoo.com".
The WinPTap or Tuntap methods are necessary if you want to connect to
coLinux from the outside. For example, to log in with ssh or access the
web server. eth1 talks to the host.
I didn't get pcap working...perhaps because I'm not behind a router with
IP masquerading (aka NAT).
Install Microsoft's loopback driver through "add hardware" in the control
panel (http://support.microsoft.com/kb/839013).
Rename the new "Local Area Connection" to "Loopback". Assign the Loopback adaptor a static IP
address. Don't use a "192.168.0" address.
- C: Drive Access
- Create a mount partition (e.g. mkdir /dosc).
- Try mounting the C drive manually (mount -t cofs 0 /dosc) and ls /dosc
to see if you can see the top directory of your C: drive. Unmount it
with umount /dosc (note: not "unmount").
- Edit /etc/fstab and add the mount command listed above in the
config file. mount /dosc. Did it mount?
- Upgrading Packages
Ubuntu is Debian-based so you need to use apt-get. Be aware that apt-get
install kde will download all of kde and will be too big for the downloaded
ubuntu file system unless you mount other file systems or some such. Also,
it helps to know the package names before you start.
apt-get update # (Ignore gpg errors)
apt-get upgrade # Update existing packages
Periodically run these commands to keep your copy of Linux up-to-date.
To upgrade to the latest version of Ubuntu:
apt-get dist-upgrade
The Ubuntu image is a minimal install. For development, you will want to
install other software. For example:
apt-get install man # Linux Manual
apt-get install nano # pico-based editor
apt-get install traceroute # Network debugging tool
apt-get install subversion # Subversion source control
apt-get install gcj # GCC Java
apt-get install gnat-3.3 # GCC Ada
apt-get install lynx # Console web browser
For LAMP (Linux/Apache/PHP) development:
apt-get install php4 # PHP version 4 + Apache
For graphical development tools like kdevelop, you can include these:
apt-get install xterm # Basic X Windows
apt-get install xfonts-base # Standard fonts for drawing
apt-get install xfonts-75dpi # Standard fonts for drawing
apt-get install kdebase # Basic KDE
apt-get install konsole # KDE-enhanced xterm
apt-get install kdevelop3 # KDevelop
For remote desktop access:
apt-get install vncserver # Virutal desktop
vncserver -geometry 1024x768 -depth 8
You have a limited amount of disk space in your Ubuntu image file so
you will not be able to install every available Ubuntu program. You can
check your free disk space with df -h.
You can, of course, install the gnome desktop and anjuta IDE instead,
or eclipse, etc.
- X Windows
coLinux cannot run X Windows applications directly because there are
(currently) no drivers to make X draw inside of a Microsoft Windows'
window. However, you can use an X system for Microsoft Windows as your
display device. For example, the one that comes with the Cygwin system.
Download and install Cygwin with X windows (that is, the basic X11
packages).
There is also xming
(http://www.sourceforge.net/projects/xming)
X windows system for Microsoft Windows.
With slirp, since you can only go "out" from coLinux, you'll need to
manually configure Cygwin as your X windows display device.
- In Windows, get your IP number with ipconfig or your TCP/IP properties on your network connection.
- Start Cygwin
- In Cygwin, start xterm with startx.
- In Cygwin, xhost + to allow any connection.
- In coLinux, export DISPLAY="your ip:0"
- In coLinux, start xterm with xterm&. Did it work? Exit xterm with the
exit command.
If it works, add the DISPLAY variable to /etc/profile so that it runs
automatically when you log in:
DISPLAY="your ip:0" ; export DISPLAY
If you have the PTap configured, you should also be able to log into
coLinux using "ssh -Y" from Cygwin and run kdevelop without having to
modify xhost or DISPLAY (ssh handles all the configuration for you).
- An Example Application: Kdevelop IDE
With X Windows configured, you should be able to run most X Windows
applications under coLinux, including kdevelop.
In coLinux, start kdevelop with kdevelop3&. You should be able to access
your Windows C: drive through the /dosc" mount point. You are now using
kdevelop on Windows.
- Logging out
Shut down your virtual machine with shutdown -h now.
Choose quit from the coLinux window menus. In NT mode, the
console window will close automatically.
- Mounting More Linux Drives
cobd is "coLinux block device". That is, files that act as disk
partitions. To create a new mountable "partition", create a file
with enough space and format it for use.
If you have your C: drive mounted under the /dosc mount point:
dd if=/dev/zero of=/dosc/colinuxfs.dat bs=10M count=1
# Create a 10 meg file
# losetup is not used for a coLinux block device
mkfs -t ext3 /dosc/colinuxfs.dat
# You will be warned that it's not a partition (block device).
Or, if your worried about Windows drive support or crashing, create
the file on a Linux machine and copy it to your Windows drive.
In the configuration file: cobd2="c:\colinuxfs.dat"
Restart coLinux.
Try mount /dev/cobd2 /mnt
You can then mount it on startup in /etc/fstab, for example, as your home directory /home and share it between different versions of Linux running under coLinux. It will also
free up some of your limited space under the root image file.