CoLinux安装教程



CoLinux安装教程

1.简介
Cooperative Linux(简称CoLinux)是首个能在Win32平台高效率地以原生方式运行Linux的
免费、开源软件,实际上她是Linux Kernel的一个移植版本。使用这个软件你可以在你的
Windows下运行Linux,比起其他商业版本的OS虚拟软件如VMware、Microsoft VPC等,她的
运行效率高的多,32M内存就可以运行X了!以下是详细的安装介绍。

2.准备工作
2.1 安装要求
操作系统:win2k 或者 WinXP
硬件要求:有空余32M内存,和1.5G硬盘空间便可

2.2软件的取得
CoLinux的主页在http://colinux.sourceforge.net/,这个网站也许需要代理才能上去,我们需
要的软件可以在以下的地址找到:
CoLinux安装文件,下载地址:
[code]

http://heanet.dl.sourceforge.net/sourceforge/colinux/coLinux-0.6.1.exe

[/code]
WinPcap支持库,下载地址:
[code]

http://winpcap.polito.it/install/bin/WinPcap_3_1_beta_3.exe

[/code]
预先安装好的CoLinux OS Image文件,选择debian 3.0r0
[code]

http://heanet.dl.sourceforge.net/sourceforge/colinux/Debian-3.0r0.ext3.1gb.bz2

[/code]
Swap文件,下载256M的。
[code]

http://gniarf.nerim.net/colinux/swap/swap_256Mb.bz2

[/code]

3.软件的安装
3.1 安装CoLinux
双击coLinux-0.6.1.exe进行安装,你可以更改安装目录,其他默认就行了,安装过程中
Windows要出现警告窗口,这是因为安装程序会安装OpenVPN项目的TAP虚拟网卡,这个虚拟网
卡驱动没有经过MS认证,所以会出现警告窗口,点“继续”就可以完成安装了。这里假设CoLinux
的安装目录是F:\colinux

3.2 安装Winpcap支持库
这个支持库是CoLinux中的虚拟网卡工作在bridged模式所需要的,下面的过程正是把CoLinux的
虚拟网卡设置为这种模式,所以需要安装。双击WinPcap_3_1_beta_3.exe进行安装,一路取
默认的选项就行了。

3.3 安装预先安装好的OS Image文件和swap文件
在F:\colinux下建立debian目录,把Debian-3.0r0.ext3.1gb.bz2解压到F:\colinux\debian目
录,解压后的文件占用1G空间,完整路径是F:\colinux\debian\Debian-3.0r0.ext3.1gb

把swap_256Mb.bz2解压到F:\colinux\debian,解压后文件占用256M空间,完整路径
F:\coLinux\debian\swap_256M

把F:\colinux目录下的default.colinux.xml拷贝一份到F:\colinux\debian目录,改名为
debian.xml,下面开始配置CoLinux。

4 配置CoLinux
4.1 配置CoLinux运行需要的xml文件
用写字板(推荐使用ultraedit或者gvim等编辑器,请不要用记事本打开)打开debian.xml,修改
内容如下(请根据你的安装目录修改):
[code]
<?xml version="1.0" encoding="UTF-8"?>;
<colinux>;
<!-- This line needs to point to your root file system.
For example change "root_fs" to the name of the Debian image.
Inside coLinux it will be /dev/cobd0 -->;
<block_device index="0" path="\DosDevices\f:\coLinux\debian\Debian-3.0r0.ext3.1gb"
enabled="true" />;

<!-- This line can specify a swap file if you wish, or an additional
image file, it will /dev/cobd1. Additional block_devices can
be specified in the same manner by increasing the index -->;

<block_device index="1" path="\DosDevices\f:\coLinux\debian\swap_256M"
enabled="true" />;

<!-- bootparams allows you to pass kernel boot parameters -->;
<bootparams>;root=/dev/cobd0</bootparams>;

<!-- image allows you to specify the kernel to boot -->;
<image path="vmlinux" />;


<!-- this line allows you to specify the amount of memory available
to coLinux -->;
<memory size="32" />;

<!-- This allows you to modify networking parameters, see the README
or website for more information -->;
<network index="0" type="bridged" name="Need_To_Be_Replaced_Soon"/>;
</colinux>;
[/code]

4.2 编辑CoLinux启动的批处理文件
在F:\Colinux目录(一定要在CoLinux的安装目录下)编写一个名为debian.bat的批处理文件,
里面的内容是:
[code]
f:\colinux\colinux-daemon.exe -c f:\colinux\debian\debian.xml
[/code]

4.3 首次运行CoLinux
双击F:\colinux\debian.bat,这时colinux开始运行,一个cmd窗口先运行,然后出现另外一个
窗口继续运行,直到出现我们熟悉的:
[code]
colinux login:
[/code]
提示符,输入root,root没有初始密码,这就进入了colinux的debian环境,先输入free,
uname -a试试看,是不是速度很快啊。哈哈,先别把debian linux停掉,接下去我们要根据窗口
的log信息设置debian linux的网络,让colinux能够连上Internet。

4.4 完成网络配置
在第一个cmd窗口中寻找类似以下的信息:
[code]
bridged-net-daemon: Checking adapter: NDIS 5.0 driver
bridged-net-daemon: Checking adapter: TAP VPN Adapter.
bridged-net-daemon: No matching adapter
Error initializing winPCap
[/code]
对应不同电脑上实际的不同网卡,第一行里面的“NDIS 5.0 driver”字串会不同,比如我的是
“E100B1 Intel 8255x-based Integrated Fast Ethernet”,重新打开debian.xml,用你
实际得到的字串代替倒数第二行的“Need_To_Be_Replaced_Soon”,比如我的修改后为:

[code]
<network index="0" type="bridged" name="E100B1 Intel 8255x-based Integrated Fast Ethernet"/>;
[/code]
这时可以用shutdown -h now关掉colinux虚拟的debian linux了。

4.5 配置debian linux环境
到此,如果不出什么问题,colinux外围环境应该都配置好了。是时候开始配置我们的debian
linux了。双击debian.bat再次启动colinux,用root用户登陆,以下的操作都是配置debian
linux的运行环境,使用的都是debian linux下的标准命令。

4.5.1 配置debian linux的网络
(a)更改root用户密码
[code]
#passwd
[/code]
(b)激活swap区
[code]
#echo /dev/cobd1 swap swap defaults 0 0 >;>;/etc/fstab
#swapon /dev/cobd1
#mount -a
#free | grep swap
[/code]
(c)配置网络
[code]
#echo 127.0.0.1 localhost.localdomain localhost >;/etc/hosts
#echo debian >;/etc/hostname
#echo 127.0.0.1 debian >;>;/etc/hosts
#echo nameserver 202.96.209.5 >;/etc/resolv.conf
#vi /etc/network/interfaces
auto lo eth0
iface lo inet loopback
iface eth0 inet static
address 10.70.14.117
gateway 10.70.14.1
netmask 255.255.255.0
[/code]
上面是我的interfaces文件的配置,请根据实际的网络情况修改,修改后重启网络:
[code]
#/etc/init.d/networking restart
#ifconfig
#netstat -rn
#ping 10.70.14.1
[/code]
用以上两条命令确认网络已经启用。
(d)配置apt source并安装常用软件
[code]
#vi /etc/apt/sources.list
deb http://debian.cn99.com/debianstable main contrib non-free
deb http://debian.cn99.com/debian-non-USstable/non-US main contrib non-free
deb http://debian.cn99.com/debian-securitystable/updates main contrib non-free
deb http://red-carpet.ximian.com/debianstable main
#apt-get update
#apt-get rcconf wget ncftp
#dselect (选默认的软件包安装就可以了)
[/code]
安装完后debian linux就启动了opensshd服务,如果习惯的话,可以使用SecureCRT之类的软
件ssh登陆到debian linux上,进行远程命令操作。
(e)安装配置gnome、VNC Server、X等
[code]
#apt-get install x-window-system-core
#echo "null" >; /etc/X11/default-display-manager
#apt-get install gdm
#apt-get install task-ximian-core
#mkdir ~/.vnc
#vi ~/.vnc/xstartup
#!/bin/sh
gnome-session &
#chmod u+x ~/.vnc/xstartup
#apt-get install vncserver
#echo "/usr/bin/gdm" >; /etc/X11/default-display-manager
#apt-get clean
[/code]
安装完后编辑/etc/X11/gdm/gdm.conf
查找[xdmcp]部分,把Enable选项设为true,如下:
[code]
Enable=true
[/code]
然后查找[servers],修改如下:
[code]
[servers]
0=Standard
[/code]
然后是修改[server-Standard]部分如下:
[code]
[server-Standard]
name=Standard server
command=/usr/X11R6/bin/Xvnc -geometry 800x600 -depth 16
flexible=true
[/code]
保存文件

启动gdm
[code]
#/etc/init.d/gdm restart
[/code]

到这里下载vnc的windows客户端
[code]

http://www.realvnc.com/dist/vnc-4.0b5-x86_win32_viewer.exe

[/code]
然后用运行这个客户端软件,在地址栏里面填入你的debian linux的ip地址,在这里是
10.70.14.117,点确定,不出意外的话,你就可以看到一个图形的登陆界面,现在可以登陆了
(不过不能使用root用户登陆,请另建用户吧),进入经典的gnome1.4.1环境,试试看速度如
何?不错吧,现在整个虚拟的debian linux只使用了32M内存(当然你可修改debian.xml文件相
关参数增加内存)。呵呵

5.后记
(a)上面的安装把使用了Native/Bridged方式的网络设置,这种方式和vmware下的bridged方式
没有什么区别,需要占用一个LAN IP地址;如果不想用bridged方式,那么可以使用NAT方式,工
作原理也和vmware下的NAT方式差不多,不过不像vmware会给你设置好,需要自己启用ICS,
或者在本机上架设一个代理之类的。具体方式请见:
[code]

http://colinux.sourceforge.net/wiki/index.php/coLinuxNetworking

[/code]
(b)也可以在本机上安装cygwin和Xfree86的Win32版本来代替VNC Server,具体参照:
[code]

http://colinux.sourceforge.net/wiki/index.php/XCoLinux

[/code]
(c)以上步骤应该足够详细,能不能成功或者遇到问题能不能解决还需要依靠你对linux的掌控程
度。
(d)参考资料
[code]

http://colinux.sourceforge.net/

http://colinux.sourceforge.net/wiki/index.php/GettingStartedLong

http://colinux.sourceforge.net/wiki/index.php

http://gniarf.nerim.net/colinux/

[/code]