CoLinux,不错

来源:互联网 发布:c语言逆波兰表达式 编辑:程序博客网 时间:2024/05/19 16:35

很早就听同事说过,有一种方法运行Linux很好:把Linux作为Windows的一个服务来运行,很方便,占用的资源也不多。我当时使用的是VMWare,觉得也不错,因此没有深究。

直到今年1月份,参加公司的Unix Shell培训,发现UWin不太好用,VMWare太占资源,于是决定查查同事早已介绍过的那种方法。

在网络上查了一下,原来是CoLinux,而且在好几年前就有人使用了。看来不错,赶紧下载下来,安装,运行,一切顺利。

当想访问网络的时候,发现了一些问题。 CoLinux缺省使用Slirp方式访问Host的网络,因此我安装的Ubuntu可以顺利地访问外网。但我无法在Host上访问到Ubuntu。

原来,CoLinux还提供了NAT方式,使你可以在Host和Ubuntu之间互相访问。不过你必须使用静态IP地址。我在Host的虚拟网卡上配置如下的IP:

注意千万不要填写网关,否则机器就无法访问网络了。

当然,在Ubuntu上也要配置同一网段的IP地址,这样Host和Ubuntu就可以互相访问了。

另外,CoLinux还可以配置从而使Ubuntu访问Windows的文件夹,这样就没必要使用samba来共享文件夹了。当然,你得在Ubuntu中把配置的cofs0装载mount进来。

下面是我的CoLinux配置:

# File contains the root file system.
# Download and extract preconfigured file from SF 
"Images for 2.6".
cobd0
="c:Program FilescoLinuxUbuntu-6.06.1.ext3.1gb"

# mount the directory from the host(Windows)
cofs0
="C:Share"

# 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

# 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 memory for linux guest
mem
=256

# 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
eth0
=slirp

# Tuntap as private network between guest and host on second linux device
eth1
=tuntap

有了网络,就可以用putty来访问了。我总觉得CoLinux自带的民命令行窗口不太舒服。

除了网络,其它的一切都不错。对于我这种只想在Linux练手的菜鸟来说,已经足够了。如果是高手,估计要考虑多安装一些东东了。

原创粉丝点击