colinux中安装debian

(0) 下载文件

colinux-0.7.8

http://www.colinux.org/
(http://nchc.dl.sourceforge.net/project/colinux/Snapshots/devel-20100702-Snapshot/devel-coLinux-20100702.exe)
注意安装colinux过程中不必下载root文件。

debian-504-i386-businesscard.iso
(http://cdp_w_picpath.debian.org/debian-cd/5.0.5/i386/iso-cd/debian-505-i386-CD-1.iso)

(1)制作空白文件:root-fs盘和swap-fs盘

fsutil file createnew debian.fs 8589934592 //8G

fsutil file createnew swap.fs 268435456

为了节省磁盘空间,我们可以使用sparse文件。

运行这样的命令:

fsutil sparse setflag debian.fs //将文件标记为sparse文件

fsutil sparse setrange debian.fs 1024 8589933568 //1024+858993356= 8589934592明白吗?

同样的命令来处理swap.fs即可。

fsutil file createnew debian.fs 4294967296
fsutil file createnew swap.fs 268435456
fsutil sparse setflag debian.fs
fsutil sparse setflag swap.fs
fsutil sparse setrange debian.fs 1024 4294966272
fsutil sparse setrange swap.fs 1024 268434432
可以将上述命令存为批处理运行。可建立4G的硬盘镜像。 NTFS分区

(2)准备开机

(2.0)获得debian安装盘iso文件。

(2.1)从iso文件提取initrd.gz,和两个img文件以及conf文件放在一起

(2.2)创建conf文件,其中引用initrd.gz和两个img文件

整个conf文件像这样(debian.conf):


# The default kernel
kernel=vmlinux

# File contains the root file system.
# Download and extract preconfigured file from SF "Images for 2.6".
cobd0="f:/debian/debian.fs"

# Swap device, should be an empty file with 128..512MB.
cobd1="F:/debian/swap.fs"
cobd2="F:/debian/debian-504-i386-businesscard.iso"

# 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="f:/debian/linux/initrd.gz"

# Maximal memory for linux guest
mem=256

eth0=slirp

(2.3)开机conf文件,安装debian ,可以写成一个bat批处理

colinux-daemon.exe @debian.conf

(3)安装过程

(3.1)安装过程中当它抱怨没有光盘时,请手工指定"/dev/cobd2"。注意选择无module仍继续。

(3.2)安装过程中当准备磁盘/分区问题时,先如下手工操作:

使用第二个虚拟控制台: (ALT+F2)

mke2fs /dev/cobd0

mkdir /target

mount /dev/cobd0 /target

mkswap /dev/cobd1

swapon /dev/cobd1

ALT+F1 切换到刚刚的控制台
然后选择<Go Back>,再仍选择分区操作,指定cobd0为/且ext3格式,cobd1为swap。

(3.3)安装GRUB

安装GRUB会失败,但是其实不需要osloader,因为colinux启动时并不是从root盘上读kernel。

可以reboot了。

(4)下次开机

下次开机之前修改conf文件到正常,比如如下。

# The default kernel
kernel=vmlinux

# File contains the root file system.
# Download and extract preconfigured file from SF "Images for 2.6".
cobd0="f:/debian/debian.fs"

# Swap device, should be an empty file with 128..512MB.
cobd1="F:/debian/swap.fs"
#cobd2="F:/debian/debian-504-i386-businesscard.iso"

# 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="f:/coLinux/initrd.gz" //这里要换成colinux默认的引导文件。第一次重启之后,把该行注释掉。只有安装后的第一次启动是需要它来引导的。

# Maximal memory for linux guest
mem=256

eth0=slirp


如果需要上网,则需要使用winpcap包
(http://www.winpcap.org/install/bin/WinPcap_4_1_2.exe)




进入系统后更新安装源

cd /etc/apt
cp source.list source.list.bak
vi  source.list

deb http://debian.anheng.com.cn/debian etch main non-free contrib
deb-src http://debian.anheng.com.cn/debian etch main non-free contrib
deb ftp://debian.anheng.com.cn/debian etch main non-free contrib
deb-src ftp://debian.anheng.com.cn/debian etch main non-free contrib
deb http://debian.cn99.com/debian/ testing main non-free contrib
deb-src http://debian.cn99.com/debian/ testing main non-free contrib

#deb http://debian.cn99.com/debian/ sid main non-free contrib
#deb-src http://debian.cn99.com/debian/ sid main non-free contrib

deb http://debian.cn99.com/debian-non-US testing/non-US main non-free contrib
deb-src http://debian.cn99.com/debian-non-US testing/non-US main non-free contrib

deb http://debian.ustc.edu.cn/debian testing main non-free contrib
deb-src http://debian.ustc.edu.cn/debian testing main non-free contrib

deb http://debian.ustc.edu.cn/debian-non-US testing/non-US main non-free contrib
deb-src http://debian.ustc.edu.cn/debian-non-US testing/non-US main non-free contrib

deb http://debian.ustc.edu.cn/debian-security testing/updates main

#deb http://debian.cn99.com/debian/ testing main
#deb-src http://debian.cn99.com/debian/ testing main


By the way, 常用的apt命令:

apt-cache search package 搜索包
apt-cache show package 获取包的相关信息,如说明、大小、版本等
sudo apt-get install package 安装包
sudo apt-get install package - - reinstall 重新安装包
sudo apt-get -f install 修复安装"-f = --fix-missing"
sudo apt-get remove package 删除包
sudo apt-get remove package - - purge 删除包,包括删除配置文件等
sudo apt-get update 更新源
sudo apt-get upgrade 更新已安装的包
sudo apt-get dist-upgrade 升级系统
sudo apt-get dselect-upgrade 使用 dselect 升级
apt-cache depends package 了解使用依赖
apt-cache rdepends package 是查看该包被哪些包依赖
sudo apt-get build-dep package 安装相关的编译环境
apt-get source package 下载该包的源代码
sudo apt-get clean && sudo apt-get autoclean 清理无用的包
sudo apt-get check 检查是否有损坏的依赖




colinux下访问windows分区

编辑下载的linux镜像文件批处理文件,以Fodera9为例,编辑 文件 start-Fedora-9.bat
colinux-daemon.exe kernel=vmlinux initrd=initrd.gz mem=512 cobd0="d:/Program Files/coLinux/Fedora-

9.img" cobd1="d:/Program Files/coLinux/swap.img" cofs0=c:/ cofs1=d:/ cofs2=e:/ cofs3=f:/

root=/dev/cobd0 eth0=slirp,,tcp:5901:5900 ro

cofs0=c:/ cofs1=d:/ cofs2=e:/ cofs3=f:/
我有四个分区,紫色men=512,我把内存分配改为512M,视自己机器配置,默认是256M

运行start-Fedora-9.bat
登录后,运行以下指令

mkdir /mnt/winC  
mount -t cofs 0 /mnt/winC
这样便加载了C盘到/mnt/winC目录下同样可以加载D-F盘,需要注意,mount -t cofs 后参数需要与批处理文件里一


具体信息详见colinux目录下文件cofs.txt



colinux如何挂载一个新的linux分区

现成的EXT3FS文件系统
http://gniarf.nerim.net/colinux/fs/

preformatted p_w_picpaths of ext3fs partitions of specific sizes to use as block devices for coLinux.

sizes are in Mb.

to use, uncompress with bunzip2, then add a line to default.colinux.xml :

<block_device index="2" path="/DosDevices/c:/colinux/fs_2048Mb" enabled="true"></block_device>

and a line to your /etc/fstab file : /dev/cobd2 /mnt ext3 defaults 0 0

please feel free to redistribute these files.
*IMPORTANT* the file 10g-ext3.bz2 can only be used under NTFS, not FAT32.
=====================================
交换分区
big files of specific sizes to use as swap block devices for coLinux.

sizes are in Mb.
you still have to edit /etc/fstab and add a line similar to :

/dev/cobd1 swap swap defaults 0 0

for a block_device declared as :
<block_device index="1" path="/DosDevices/c:/swap/blank_64Mb" enabled="true"></block_device>
you don't have to type mkswap /dev/cobd1 since it's already done.

(use your favorite winzip clone or bunzip2 from Cygwin or somewhere else :
http://gnuwin32.sourceforge.net/packages/bzip2.htm

don't complain too much about .bz2 files since Root Filesystem
Images for coLinux (Debian, Gentoo) are provided as .bz2 files too.)

please feel free to redistribute these files.