coLinux介绍
如果你还在为cygwin下build php失败或其他类似的问题而烦恼,向你隆重推荐很好用的coLinux,和vmware类似是虚拟机技术,而且是free的。我感觉非常稳定,速度也很快(比cygwin)。
这里有更好的教程
http://studftp.stut.edu.tw/~m9335203/colinux/colinux.html
我写的这个只是为了自己方便(每次安装都要读那么长的教程太痛苦了)总结了一个不用思考的step by step,基本上copy+paste每一行命令应该就应该能用了
预先准备
下载并安装coLinux,我用的是coLinux-0.6.3.exe
创建目录 C:\Program Files\coLinux\debian\
下载Debian Netinst或Business Card CD。我用的是debian-31r1a-i386-netinst.iso
下载文件系统文件并解压至”C:\Program Files\coLinux\debian”。我用的是fs_2048Mb.bz2
下载Swap系统文件并解压至”C:\Program Files\coLinux\debian”。我用的是swap_512Mb.bz2
用记事本创建文件 C:\Program Files\coLinux\debian\debian-inst.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<colinux>
<block_device index=”0″ path=”\DosDevices\C:\Program Files\coLinux\debian\fs_2048Mb” enabled=”true” />
<block_device index=”1″ path=”\DosDevices\C:\Program Files\coLinux\debian\swap_128Mb”
enabled=”true” />
<block_device index=”2″ path=”\DosDevices\C:\Program Files\coLinux\debian\initrd” enabled=”true” />
<block_device index=”3″ path=”\DosDevices\C:\Program Files\coLinux\debian\debian-31r1a-i386-netinst.iso”
enabled=”true” />
<bootparams>root=/dev/cobd2</bootparams>
<image path=”vmlinux” />
<memory size=”128″ />
<network index=”0″ type=”tap” />
</colinux>
用记事本创建文件 C:\Program Files\coLinux\debian\debian.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<colinux>
<block_device index=”0″ path=”\DosDevices\C:\Program Files\coLinux\debian\fs_2048Mb” enabled=”true” />
<block_device index=”1″ path=”\DosDevices\C:\Program Files\coLinux\debian\swap_128Mb” enabled=”true” />
<block_device index=”2″ path=”\DosDevices\C:\Program Files\coLinux\debian\initrd” enabled=”true” />
<bootparams>root=/dev/cobd0</bootparams>
<image path=”vmlinux” />
<memory size=”128″ />
<network index=”0″ type=”tap” />
</colinux>
还没写完
安装全攻略
copy paste每一行命令应该就行
进入DOS命令行
cd “C:\Program Files\coLinux\”
colinux-daemon.exe -c “C:\Program Files\coLinux\debian\debian-inst.xml” -t nt
进入Debian文本界面的安装
Choose a language: English
Choose a country, territory or area: United States
Keymap to use: American English
Load CD-ROM drivers from a driver floppy? No
Manually select a CD-ROM module and device? Yes
Module needed for accessing the CD-ROM: none
Device file for accessing the CD-ROM: /dev/cobd/3
Continue the install without loading kernel modules? Yes
Hostname: dev
Domain name: songchen.org
Protocol for files download: ftp
Debian archive mirror country: China
Debian archive mirror: ftp.linuxforum.net
FTP proxy information (blank for none): (直接回车)
Debian version to install: stable
Please check that a hard disk is attached to this machine.
按ALT+F2, 进入黑色背景的终端
按回车
mke2fs -j /dev/cobd/0
mkdir /target
mount /dev/cobd/0 /target
cd /target/
按ALT+F1返回安装界面
Please check that a hard disk is attached to this machine. Continue
Install the base system
Kernel to install: Kernel-image-2.6.8-2-686
Check /var/log/messages or see virtual console 3 for the details.
按ALT+F2,进入黑色背景的终端
mkdir /target/dev/cobd; for i in 0 1 2 3 4 5 6 7 8 9 10 \
11 12 13 14 15 16 17 18 19 20 \
21 22 23 24 25 26 27 28 29 30 31; \
do mknod /target/dev/cobd/$i b 117 $i; done
echo ” /dev/cobd/0 / ext3 defaults 1 1″ >> /target/etc/fstab
echo “/dev/cobd/1 swap swap defaults 0 0″ >> /target/etc/fstab
reboot
回到DOS提示符
colinux-daemon.exe -c “C:\Program Files\coLinux\debian\debian.xml” -t nt
首次以root身份登录
dev login: root
先修改apt的源,我这里用中科大的最快。
vi /etc/apt/sources.list
找到 deb http://debian.ustc.edu.cn/debian sarge main
改为 deb ftp://ftp.debian.org.cn/mirror/debian/ sarge main
更新apt的包信息
apt-get update
我喜欢vim,先安装之
apt-get install vim
我的adsl猫是路由模式,可以给coLinux分配个内网静态ip。
vi /etc/network/interfaces
找到 iface eth0 inet dhcp
改为
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.0.1
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.254
重起网络
/etc/init.d/networking restart
base-config
进入配置界面
Configure timezone
Is the hardware clock set to GMT? No
Area for your time zone: Asia
Select a city or time zone: Shanghai
Set up users and passwords
Finish configuring the base system
安装sshd,我不喜欢用xwindow和vnc
apt-get install ssh
Allow SSH protocol 2 only: Yes
Do you want /usr/lib/ssh-keysign to be installed SUID root? Yes
Do you want to run the sshd server? Yes
修改sshd配置
vi /etc/ssh/sshd_config
修改为 PermitRootLogin no
重起sshd
/etc/init.d/ssh restart
我喜欢sudo,安装之
apt-get install sudo
配置sudo
visudo
在文件结尾添加(song是我的用户名) song ALL=NOPASSWD:ALL
修改我的bash profile
vi /home/song/.bash_profile
在文件结尾添加 PS1=”`whoami`@`hostname`:\`pwd\`>”
alias ls=’ls –color’
alias ll=’ls -aslh –color’
alias cd..=’cd ..’
alias r=’sudo’
alias rvi=’sudo vim’
搞定收工