日期:2014-05-16  浏览次数:20669 次

使用colinux在windows上虚拟linux
? Cooperative Linux is the first working free and open source method for optimally running Linux on Microsoft Windows natively. More generally, Cooperative Linux (short-named coLinux) is a port of the Linux kernel that allows it to run cooperatively alongside another operating system on a single machine. For instance, it allows one to freely run Linux on Windows 2000/XP, without using a commercial PC virtualization software such as VMware , in a way which is much more optimal than using any general purpose PC virtualization software.

colinux的优点:
????????coLinux 是使用和试验 Linux 的一种好方法。与 Cygwin 相似,coLinux 允许在 Windows 操作系统上开发和执行 Linux 应用程序。还可以用 apt-get 安装、更新或删除应用程序,从而维护 Linux 操作系统。
????????与 Cygwin 不同的是,在 coLinux 上执行 Linux 应用程序不需要重新构建。从这个角度来说,coLinux 是与 Windows 操作系统协作的真正的 Linux 操作系统。
????????coLinux 另一个令人感兴趣的优点是可移植性。可以在一个 Windows 主机上建立一个 coLinux 发行版,并在根文件系统中安装一套定制的应用程序。然后,可以将根文件系统转移到另一个主机,并重新启动。这样就有了一个可移动的开发平台,压缩后的根文 件系统完全可以放在一个标准 USB 记忆棒中。
????????最后,coLinux 的速度很快,因为它本质上是在本机硬件中运行的。

colinux的安装
????????可以先登录到colinux的主站,进行下载,下载会链接到sourceforge,http://sourceforge.net/project/showfiles.php?group_id=98788 ,下载coLinux-0.7.3.exe ,只有不到5m的大小,下载后就可以按照windows式的软件安装模式一路点击“Next”,就安装成功了,在安装的过程中可以由安装程序来下载根系统镜像,也可以自己下载,我分别下载了debian和fedora,前者很小,居然只有40M。

colinux的配置
????????1、快速启动colinux进行体验
????????????????运行命令:colinux-daemon kernel=vmlinux initrd=initrd.gz root=/dev/ram0
????????2、运行下载的Images 2.6.x Debian,将下载的Debian-4.0r0-etch.ext3.1gb.bz2 ?解压,得到一个名字为Debian-4.0r0-etch.ext3.1gb的debian根文件系统
????????????????运 行命令:colinux-daemon kernel=vmlinux initrd=initrd.gz cobd0="C:\Program Files\coLinux\Debian-4.0r0-etch.ext3.1gb" root=/dev/cobd0
????????3、运行下载的Images 2.6.x Fedora,这是一个自解压文件,加压缩后得到Fedora-9.img等几个文件
????????????????运 行命令:colinux-daemon kernel=vmlinux initrd=initrd.gz mem=256 cobd0="D:\a\Fedora-9.img" cobd1="D:\a\swap.img" root=/dev/cobd0 eth0=slirp,,tcp:5901:5900 ro
????????4、网络配置:玩虚拟机,如果没有网络支持肯定没有意思,colinux也提供了3种方式的网络连接:slirp | tuntap | pcap-bridge
????????????????4.1?slirp, 最简单的网络连接方式,不需要我们的windows上安装额外的软件或配置,对比vmware,这个就像NAT方式上网一样,可以采用类似 ethX=slirp,<MAC>,<redirections>的配置方式,如 eth0=slirp,,tcp:5901:5900
????????????????4.2?tuntap,和vmware的private network方式相当,需要在windows上创建一个虚拟的连接(安装colinux的时候已经安装好),通常名字为“本地连接2”,可以采用类 似?ethX=tuntap,<network connection name>,<MAC>的配置方式,如eth0=tuntap,colinux,00:00:00:EE:EE:FF(我把本地连接2 改名为“colinux”了),这种方式不能让虚拟机直接上外网,需要在windows上设置路由。
????????????????4.3?pcap- bridge,这个就是直接桥接的方式,在逻辑上看和我们的windows连接到不上的设备端口,配置方式为?ethX=pcap-bridge,& lt;network connection name>,<MAC>,<promisc>,注意这个network connection name和tuntap配置的不同,tuntap配置的网络连接是虚拟出来的,而桥接方式配置的网络连接是真实的网络连接,这样就可以对虚拟机分配网络地 址,也就可以正常访问外网了,我比较喜欢这种方式。
????????各个命令参数的含义主要可以参考安装目录的README.txt和colinux-daemon.txt,介绍的比较详细。

andlinux简介
??????? 最后,顺便提一下andlinux,andlinux的官网 是这样描述的:

andLinux is a complete Ubuntu Linux system running seamlessly in Windows 2000 based systems (2000, XP, 2003, Vista; 32-bit versions only). This project was started for Dynamism for the GP2X community, but its userbase far exceeds its original design. andLinux is free and will remain so, but donations are greatly needed.

andLinux uses coLinux as its core which is confusing for many people. coLinux is a port of the Linux kernel to Windows. Although this technology is a bit like running Linux in a virtual machine, coLinux differs itself by being more of a merger of Windows and the Linux kernel and not an emulated PC, making it more efficient. Xming is used as X server and PulseAudio as sound server.