想要本機環境乾淨..深怕之後亂改設定出問題..當然需要一個chroot環境來當作工作區.
先前在公司都是很多厲害的前輩已經架設好環境,提供給後輩使用.
一直以來只是跟著別人腳步跑,這次待業中..就來好好研究一下!
#這次先使用最簡單的方法透過Debootstrap來製作chroot環境
root@ubuntu:/home# mkdir chroot1
root@ubuntu:/home# cd chroot1/
root@ubuntu:/home/chroot1# export target=/home/chroot1
root@ubuntu:/home/chroot1# sudo apt-get install debootstrap
root@ubuntu:/home/chroot1# dpkg -L debootstrap (查看要裝什麼version,list all version that can make)
…
/usr/share/debootstrap/scripts/quantal
/usr/share/debootstrap/scripts/jessie
/usr/share/debootstrap/scripts/trusty
/usr/share/debootstrap/scripts/etch
/usr/share/debootstrap/scripts/squeeze
/usr/share/debootstrap/scripts/intrepid
/usr/share/debootstrap/scripts/maverick
/usr/share/debootstrap/scripts/hardy
/usr/share/debootstrap/scripts/natty
/usr/share/debootstrap/scripts/precise

(Get data form URL by script,you can change item by yourself.)
root@ubuntu:/home/chroot1# sudo debootstrap precise $target http://tw.archive.ubuntu.com/ubuntu/

# become root, copy some settings
$ sudo su -
# cp /etc/apt/sources.list $target/etc/apt/
# cp /etc/resolv.conf $target/etc/
# cp /etc/hosts $target/etc/

# mount something
mount -t proc proc $target/proc/
mount -t sysfs sys $target/sys/
mount -o bind /dev $target/dev/
mount -t devpts pts $target/dev/pts/

go into chroot env.
# chroot $target
inside chroot
-------------
# export LC_ALL=C
# export LANG=C
# apt-get update

Then,do you want to do!!!

參考連結:
1.Ubuntu下chroot环境的制作
2.使用Debootstrap 建立一個基本的Linux Ubuntu系統

後續再透過一個步驟一個步驟慢慢建立,有助於了解一個linux系統需要有什麼套件/目錄才能work.
Building the LFS System