This is just a quick note that I posted so that I have how the commands to create an OpenVZ template cache with Debian.
Perform the following commands on the host node to load the base system:
aptitude install debootstrap debootstrap --arch i386 squeeze /vz/private/777 http://http.us.debian.org/debian/ vzctl set 777 --applyconfig vps.basic --save sh -c 'echo OSTEMPLATE="debian-5.0" >> /etc/vz/conf/777.conf' vzctl set 777 --ipadd x.x.x.x --save vzctl set 777 --nameserver x.x.x.x --save vzctl start 777 vzctl enter 777
Perform the following commands on the CT to prepare to be used as a template cache:
export PATH=/sbin:/usr/sbin:/bin:/usr/bin cat < /etc/apt/sources.list deb http://http.us.debian.org/debian squeeze main contrib deb http://security.debian.org squeeze/updates main contrib EOF aptitude update
*At this point install any other programs that you want the machine to have by default with aptitude.
aptitude upgrade aptitude install ssh quota less chmod 700 /root usermod -L root sed -i -e '/getty/d' /etc/inittab sed -i -e '[email protected]\([[:space:]]\)\(/var/log/\)@\1-\[email protected]' /etc/*syslog.conf rm -f /etc/mtab ln -s /proc/mounts /etc/mtab rm -f /etc/ssh/ssh_host_* cat << EOF > /etc/rc2.d/S15ssh_gen_host_keys #!/bin/bash ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N '' ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N '' rm -f \$0 EOF chmod a+x /etc/rc2.d/S15ssh_gen_host_keys ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime aptitude clean exit
Perform the following commands on the host node to prepare the final template cache files:
vzctl set 777 --ipdel all --save nano /vz/private/777/etc/resolv.conf rm -f /vz/private/777/etc/hostname vzctl stop 777 cd /vz/private/777 tar --numeric-owner -zcf /vz/template/cache/debian-4.0-i386-minimal.tar.gz .