2,253
edits
Changes
m
Robot: Automated text replacement (-VE +container)
This article describes how you can update an existing precreated Debian or Ubuntu template. The procedure is pretty easy.
== Creating/configuring a temporary VE container ==
First, you need to create a VE container based on the template you want to update. Here is an example:
[HN]# vzctl create 555 --ostemplate debian-4.0-i386-minimal
[HN]# vzctl set 555 --ipadd x.x.x.x --nameserver y.y.y.y --save
You can get the value of nameserver from your /etc/resolv.conf. Your VE container should have an Internet access, so you either supply a public IP, or see [[using NAT for VE container with private IPs]] for information about how to use private IP and NAT.
Finally, check that Internet is working from inside a VEcontainer:
[HN]# vzctl exec 555 ping -n 3 www.ru
== Update ==
Enter the VEcontainer:
[HN]# vzctl enter 555
Update metadata and install updates:
[VEcontainer]# apt-get update && apt-get upgrade
Cleanup:
[VEcontainer]# apt-get clean [VEcontainer]# > /etc/resolv.conf
Clean unused log files, .bash_history etc, then exit from a VEcontainer: [VEcontainer] # exit
Stop a VEcontainer, remove its IP:
[HN]# vzctl stop 555
[HN]# vzctl set 555 --ipdel all --save
The sizes should not differ much.
Try to create and start VE container made from your new template:
[HN]# vzctl create 222 --ostemplate debian-4.0-i386-minimal
[HN]# vzctl set 222 --ipadd 10.0.0.222 --save
[HN]# vzctl enter 222
Now execute a few basic commands to check VE container is fine. Examples are: <code>ps axf</code>, <code>dpkg -l</code>, etc.
Finally, clean up the testing VEcontainer:
[HN]# vzctl stop 222
[HN]# vzctl destroy 222