webvz: ทำ container ใช้เอง

บันทึกการทำ container ใช้เอง ด้วย debootstrap

# aptitude install debootstrap
# cd /var/lib/vz/private
# mkdir 1001
# debootstrap --arch=amd64 lenny 1001 http://server1.example.com:9999/debian
# cp /etc/apt/sources.list 1001/etc/apt/
# chroot 1001
# aptitude install console-data locales ssh screen less vim
# dpkg-reconfigure locales
# passwd
# aptitude update
# aptitude upgrade
# vi /etc/inittab
...
ตัดทิ้ง--------8<---------------------
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6
จบตัดทิ้ง--------->8--------------------
...

(อาจติดตั้งแพกเกจ หรือปรับแต่งค่าอื่น ๆ ที่จำเป็นเพิ่มได้)

# exit

เก็บไว้ใช้ในโอกาสต่อไป

# cd 1001
# tar cfz ../debian.tar.gz *

เที่ยวหลังก็สามารถแตกไฟล์ออกมาใช้งานได้ เช่น

# mkdir 1002
# cd 1002
# tar xfz ../debian.tar.gz

เป็นต้น