Changes

Jump to: navigation, search

Updating Debian template

289 bytes added, 16:02, 19 May 2015
modified to use unified way of mounting the container (ploop and non-ploop, doesn't matter)
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:
[HWHN]# vzctl create 555 --ostemplate debian-4.0-i386-minimal
Next, you want to specify an IP address and a nameserver:
[HWHN]# 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.
Then start your container: [HN]# vzctl start 555 Finally, check that Internet is working from inside a VEyour container: [HWHN]# vzctl exec 555 ping -n 3 -c 1 www.ru
== Update ==
Enter the VEcontainer: [HWHN]# 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: [VE0HN]# vzctl stop 555 [VE0HN]# vzctl set 555 --ipdel all --save
== Packing a new template cache ==
Now, rename the existing template cache:
[HWHN]# mv /vz/template/cache/debian-4.0-i386-minimal.tar.gz{,-old} Change to VE folder: [HN]# vzctl mount 555 [HN]# cd /vz/root/555
Now create a new tarball:
[HW]# cd /vz/private/555 [HWHN]# tar --numeric-owner -czf /vz/template/cache/debian-4.0-i386-minimal.tar.gz .
Clean up:
[HWHN]# vzctl umount 555 [HN]# vzctl destroy 555 [HWHN]# rm -f /etc/vz/conf/555.conf.destroyed
== Test new template cache ==
First, compare the sizes of the old and the new template caches:
[HWHN]# ls -lh /vz/template/cache/debian-4.0-i386-minimal*
-rw-r--r-- 1 root root 55M 2007-11-13 18:11 /vz/template/cache/debian-4.0-i386-minimal.tar.gz
-rw-r--r-- 1 root root 53M 2007-08-31 02:46 /vz/template/cache/debian-4.0-i386-minimal.tar.gz-old
The sizes should not differ much.
Try to create and start VE container made from your new template: [HWHN]# vzctl create 222 --ostemplate debian-4.0-i386-minimal [HWHN]# vzctl set 222 --ipadd 10.0.0.222 --save [HWHN]# vzctl start 222 [HWHN]# vzctl enter 222 Now execute a few basic commands to check container is fine. Examples are: <code>ps axf</code>, <code>dpkg -l</code>, etc.
Now execute a few basic commands to check VE is fine. Examples areFinally, clean up the testing container: <code>ps axf</code>, <code>dpkg [HN]# vzctl stop 222 [HN]# vzctl destroy 222 [HN]# rm -l<f /code>, etc/vz/conf/222.conf.destroyed
Finally, clean up the testing VE[[Category:Templates]] [HW]# vzctl stop 222 [HWCategory: Debian]# vzctl destroy 222 [HW]# rm -f /etc/vz/conf/222.conf.destroyed

Navigation menu