Création d'un template OpenVZ debian etch "type AUF Dakar"

# vérifier l'espace dispo sur /var/lib/vz/private/
root@rajako:~# df --si /var/lib/vz/private/
Sys. de fich.          Tail.  Occ.  Disp. %Occ. Monté sur
/dev/hda1              9,9G   1,9G   7,5G  20% /
root@rajako:~# debootstrap --arch i386 etch /vz/private/103 http://miroirs.refer.sn/debian
root@rajako:~# vzctl set 103 --applyconfig vps.basic --save
Saved parameters for VE 103
# pour pouvoir bosser dessus : à virer lors du packaging
root@rajako:~# vzctl set 103 --netif_add eth0,00:E1:40:00:10:31,veth103.0,00:E1:40:00:10:32 --save
Saved parameters for VE 103
# pour postfix (entre autre)
root@rajako:~# sed -i 's/^NUMOTHERSOCK=.*/NUMOTHERSOCK="200:200"/' /etc/vz/conf/103.conf
root@rajako:~# cat <<EOF >>/etc/vz/conf/103.conf
OSTEMPLATE="debian-i386-4.0"
HOSTNAME="template-etch-i386"
EOF
root@rajako:~# cat << EOF > $PRIVATE/etc/apt/sources.list
deb http://miroirs.refer.sn/debian etch main contrib non-free
deb http://miroirs.refer.sn/debian-security testing/updates main contrib non-free
deb http://security.debian.org/ etch/updates main contrib non-free
EOF
root@rajako:~# cat << EOF >$PRIVATE/etc/network/interfaces.template
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
EOF
root@rajako:~# export PRIVATE=/var/lib/vz/private/103/
root@rajako:~# sed -i -e '/getty/d' $PRIVATE/etc/inittab
root@rajako:~# cp $PRIVATE/etc/network/interfaces.template $PRIVATE/etc/network/interfaces
root@rajako:~# cp /etc/sudoers $PRIVATE/etc/sudoers
root@rajako:~# echo "*.* @syslog-ovz" >$PRIVATE/etc/syslog.conf
root@rajako:~# vzctl start 103
Starting VE ...
VE is mounted
Setting CPU units: 1000
Set hostname: template-etch-i386
Configure veth devices: veth103.0 
VE start in progress...
root@rajako:/etc/vz/conf# vzctl enter 103
entered into VE 103
template-etch-i386:/# pwconv
template-etch-i386:/# rm -f /etc/mtab
template-etch-i386:/# ln -s /proc/mounts /etc/mtab
template-etch-i386:/# aptitude update && aptitude upgrade
template-etch-i386:/# aptitude purge nano cyrus-sasl2-doc module-init-tools
template-etch-i386:/# aptitude install less ssh sudo mtr-tiny apt-listchanges emacs21-nox mailx locales apticron
template-etch-i386:/# dpkg-reconfigure apt-listchanges
Replacing config file /etc/apt/listchanges.conf with new version
template-etch-i386:/# dpkg-reconfigure locales
template-etch-i386:/# cat <<EOF >/etc/exim4/update-exim4.conf.conf
dc_eximconfig_configtype='satellite'
dc_other_hostnames=''
dc_local_interfaces='127.0.0.1'
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost='smtp.refer.sn'
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname='false'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'
EOF
template-etch-i386:/# update-exim4.conf
template-etch-i386:/# cat <<EOF >/etc/aliases
mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
root: root+template <à> refer.sn
EOF
template-etch-i386:/# newaliases
template-etch-i386:/# update-alternatives --set editor /usr/bin/emacs21
template-etch-i386:/# for truc in klogd openbsd-inetd; do update-rc.d -f $truc remove ; done
template-etch-i386:/# apt-get clean
template-etch-i386:/# logout
exited from VE 103
root@rajako:~# vzctl stop 103
Stopping VE ...
VE was stopped
VE is unmounted
root@rajako:~# vzctl set 103 --netif_del all --save
Saved parameters for VE 103
root@rajako:~# cd /var/lib/vz/private/103
root@rajako:/var/lib/vz/private/103# tar zcf /var/lib/vz/template/cache/debian-4.0-i386-aufdakar.tar.gz .

Tini/Notes/OpenVZ/Template (dernière édition le 2008-02-21 22:09:27 par localhost)