Debian µÄ¹¤¾ßdebootstrap¿ÉÒÔÓÃÓÚÔÚϵͳµÄij¸öĿ¼Öа²×°Ò»Ì×»ù±¾ÏµÍ³£¬Õâ¸ö»ù±¾ÏµÍ³³ýÁËһЩÅäÖÃÏîÍ⣬ÓëDebian°²×°³ÌÐòÔÚ°²×°µÄµÚÒ»½×¶Î°²×°µÄÄÚÈÝ»ù±¾Ïàͬ¡£ÕâÏÄÜÓÐÐí¶àÓÐȤµÄ¹¦ÄÜ£¬ÀýÈ磬Äã¿ÉÒÔ´Óij¸ö¶¨ÖÆ°æ±¾µÄDebian Live¹âÅÌÉÏͨ¹ýÕâ¸öÃüÁî¿ìËÙµÄÔÚÓ²ÅÌÉÏ°²×°Debian¶ø²»ÐèÒªDebianµÄ°²×°³ÌÐò£¬Ò²¿ÉÒÔ°Ñ´´½¨ÔÚÓ²ÅÌÉϵĻù±¾ÏµÍ³Ä¿Â¼×÷ΪijЩÉ漰ϵͳ°²È«ÐÔ·þÎñµÄchrootÔËÐл·¾³£¬Í¨¹ýchroot½øÈë¸ÃĿ¼²¢µ÷ÊÔºÍÔËÐÐһЩ¿ÉÄÜÐÞ¸ÄϵͳÅäÖõÄÓ¦ÓóÌÐò£¬×÷Ϊ¶¨ÖÆСÐÍϵͳģ°åµÈµÈ¡£
Debootstrap±ØÐèÒÔrootÉí·ÝÀ´ÔËÐУ¬Èç¹ûµ±Ç°ÏµÍ³ÖÐûÓÐÕâ¸ö¹¤¾ß£¬¿ÉÒÔͨ¹ýÏÂÃæµÄÃüÁîÀ´°²×°£º
[code]root@debian ~# apt-get install debootstrap[/code]
ÏÂÃæÎÒÃÇÀ´¿´Ò»Ï£¬ÈçºÎÔÚµ±Ç°DebianϵͳÖÐij¸öĿ¼Àï°²×°Ò»¸öDebianµÄ»ù±¾ÏµÍ³¡£¼ÙÉèÎÒÃǽ«»ù±¾ÏµÍ³°²×°µ½ /root/chroot_env Ŀ¼Ï£¬Ö»ÐèҪͨ¹ýÏÂÃæµÄÃüÁî¼´¿ÉÍê³É°²×°¹ý³Ì£º
[code]root@debian ~# mkdir /root/chroot_env
root@debian ~# debootstrap sarge /root/chroot_env http://debian.cn99.com/debian
I: Retrieving Release
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Found additional required dependencies: libtext-iconv-perl zlib1g
I: Checking component main on http://debian.cn99.com/debian...
I: Retrieving adduser
I: Validating adduser
I: Retrieving apt
I: Validating apt
....
I: Installing core packages...
I: Unpacking required packages...
I: Configuring required packages...
I: Installing base packages...
I: Base system installed successfully.
root@debian ~#[/code]
¼¸·ÖÖÖºó£¨È¡¾öÓÚÄãÑ¡È¡µÄDebian¾µÏñºÍÍøÂçËٶȵȣ©£¬°²×°¹ý³Ì½áÊø£¬ÔÚĿ¼ /root/chroot_envÖÐÒѾÓÐÒ»¸öȫа²×°µÄDebian»ù±¾ÏµÍ³¡£ÎÒÃÇ¿ÉÒÔͨ¹ýchrootÃüÁîÀ´½øÈëµ½¸Ã»ù±¾ÏµÍ³»·¾³£º
[code]root@debian ~# chroot /root/chroot_env
root@debian /# ls
bin dev home lib mnt proc sbin sys usr
boot etc initrd media opt root srv tmp var
root@debian /# apt-get clean
root@debian /# du -sh
111M .[/code]
»ù±¾ÏµÍ³´óÔ¼110M×óÓÒ¡£Èç¹ûÏ£ÍûÔÚ»ù±¾ÏµÍ³ÖÐÖ´ÐÐһЩÓëϵͳÏà¹ØµÄÃüÁӦµ±ÏÈÔڸûù±¾ÏµÍ³ÖмÓÔØprocÎļþϵͳ£¬²¢ÇÒÆä·´Ó³µÄһЩÐÅÏ¢¶¼Êǵ±Ç°ÏµÍ³µÄÐÅÏ¢¡£
[code]root@debian /# mount -t proc proc /proc
root@debian /# ps -aef # ½«ÏÔʾÖ÷»úµÄËùÓнø³Ì
...
root@debian /# hostname # ½«ÏÔʾµ±Ç°Ö÷»úÃû¶ø·ÇÐÂϵͳÖ÷»úÃû
redice[/code]
Èç¹ûÉÏÊö¹ý³ÌÖУ¬/root/chroot_envĿ¼¹Ò½ÓÁËÒ»¸öÓ²ÅÌ·ÖÇøµÄ»°£¬ÐµÄϵͳ½«¿ÉÒÔͨ¹ýLilo£¬grubµÈ×÷Ϊ¸ù·ÖÇøÀ´Òýµ¼ÏµÍ³¡£Õâʱ£¬ÐèÒª½øÐÐһЩ±ØÒªµÄÅäÖã¬Èç/etc/hosts£¬/etc/hostname£¬/etc/network/interfacesÎļþµÈ¶¼ÐèÒª½øÐÐÊʵ±µÄÐ޸ġ£ÁíÍ⣬ÓÉÓÚͨ¹ýdebootstrap½øÐа²×°Ê±£¬ÎÞ·¨È·ÖªÓ²Å̵ķÖÇøÇé¿ö£¬Òò´Ë£¬»¹±ØÐèÊÖ¹¤ÐÞ¸Ä/etc/fstabÎļþ¡£