OpenVZ

From PostgreSQL_wiki
Jump to: navigation, search

debootstrap

Gebruik debootstrap om een maagdelijke machine te bouwen.

root@dom0:~# debootstrap --arch amd64 \
 --include=ssh,mc,locales-all,localepurge,subversion,cfengine3,nfs-common,less \ 
 squeeze /var/lib/vz/private/100 http://mirror.webhuis.nl:3142/debian

Met behulp van de include optie is een nuttig aantal packages toegevoegd. openVZ maakt bij de eerste start van een machine het bestand /etc/vz/conf/100.conf aan:

root@dom0:~# vzctl start 100

Zet de machine voor de volgende stappen daarna weer uit: <per> root@dom0:~# vzctl stop 100 root@dom0:~# vzctl set 100 --applyconfig webhuis-basis --save root@dom0:~# sh -c 'echo "OSTEMPLATE=debian-6.0" >> /etc/vz/conf/100.conf' root@dom0:~# vzctl set 100 --ipadd 10.99.99.189 --save root@dom0:~# vzctl set 100 --nameserver 10.99.99.187 --save


 563  tar --numeric-owner -zcf /var/lib/vz/template/cache/debian-6.0-amd64-minimal.tar.gz .
 564  vzctl create 102 --ostemplate debian-6.0-amd64-minimal
 565  vzctl start 102
 566  vzctl exec 102  ps ax
 567  vzctl stop 102
 568  vzctl exec 102  ps ax
 569  vzctl destroy 102
 570  vzctl start 101
 571  vzctl exec 101  ps ax
 572  vzctl enter 101
 573  vzctl set 101 --ipdel all --save
 574  vi /var/lib/vz/private/101/etc/resolv.conf 
 575  rm -f  /var/lib/vz/private/101/etc/hostname 
 576  vzctl stop 101
 577  history | grep tar
 578  tar --numeric-owner -zcf /var/lib/vz/template/cache/debian-6.0-amd64-minimal.tar.gz .
 579  man cp
 580  man rsync
 581  vzctl start 101
 582  vzctl enter 101
 583  vzctl enter 101
 584  vzctl stop 101
 585  ls -al ../../template/
 586  ls -al ../../template/cache/
 587  tar --numeric-owner -zcf /var/lib/vz/template/cache/debian-6.0-amd64-minimal.tar.gz .
 588  ls -al ../../template/cache/
 589  cd ..
 590  history | grep create
 591  vzctl create 1234567890 --ostemplate debian-6.0-amd64-minimal
 592  vzctl start 1234567890
 593  vzctl exec 1234567890 ps ax
 594  vzctl enter 1234567890
 595  vzctl stop 1234567890
 596  vzctl destroy 1234567890
 597  rm /etc/vz/conf/1234567890.conf.destroyed 
 598  ls -al /etc/vz/conf/
 599  rm /etc/vz/conf/102.conf.destroyed
 600  history | grep vzct
 601  vzctl exec 101  ps ax



Terug naar: Webhuis bouwstenen