<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SciFi-Bob</id>
	<title>OpenVZ Virtuozzo Containers Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SciFi-Bob"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/SciFi-Bob"/>
	<updated>2026-06-14T04:16:25Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Updating_Debian_template&amp;diff=5864</id>
		<title>Updating Debian template</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Updating_Debian_template&amp;diff=5864"/>
		<updated>2008-05-05T00:22:21Z</updated>

		<summary type="html">&lt;p&gt;SciFi-Bob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes how you can update an existing precreated Debian or Ubuntu template. The procedure is pretty easy.&lt;br /&gt;
&lt;br /&gt;
== Creating/configuring a temporary container ==&lt;br /&gt;
&lt;br /&gt;
First, you need to create a container based on the template you want to update. Here is an example:&lt;br /&gt;
&lt;br /&gt;
 [HN]# vzctl create 555 --ostemplate debian-4.0-i386-minimal&lt;br /&gt;
&lt;br /&gt;
Next, you want to specify an IP address and a nameserver:&lt;br /&gt;
 [HN]# vzctl set 555 --ipadd x.x.x.x --nameserver y.y.y.y --save&lt;br /&gt;
&lt;br /&gt;
You can get the value of nameserver from your /etc/resolv.conf. Your container should have an Internet access, so you either supply a public IP, or see [[using NAT for container with private IPs]] for information about how to use private IP and NAT.&lt;br /&gt;
&lt;br /&gt;
Then start your container:&lt;br /&gt;
 [HN]# vzctl start 555&lt;br /&gt;
&lt;br /&gt;
Finally, check that Internet is working from inside your container:&lt;br /&gt;
 [HN]# vzctl exec 555 ping -n -c 1 www.ru&lt;br /&gt;
&lt;br /&gt;
== Update ==&lt;br /&gt;
 &lt;br /&gt;
Enter the container:&lt;br /&gt;
 [HN]# vzctl enter 555&lt;br /&gt;
&lt;br /&gt;
Update metadata and install updates:&lt;br /&gt;
 [container]# apt-get update &amp;amp;&amp;amp; apt-get upgrade&lt;br /&gt;
&lt;br /&gt;
Cleanup:&lt;br /&gt;
 [container]# apt-get clean&lt;br /&gt;
 [container]# &amp;gt; /etc/resolv.conf&lt;br /&gt;
&lt;br /&gt;
Clean unused log files, .bash_history etc, then exit from a container:&lt;br /&gt;
 [container] # exit&lt;br /&gt;
&lt;br /&gt;
Stop a container, remove its IP:&lt;br /&gt;
 [HN]# vzctl stop 555&lt;br /&gt;
 [HN]# vzctl set 555 --ipdel all --save&lt;br /&gt;
&lt;br /&gt;
== Packing a new template cache ==&lt;br /&gt;
&lt;br /&gt;
Now, rename the existing template cache:&lt;br /&gt;
 [HN]# mv /vz/template/cache/debian-4.0-i386-minimal.tar.gz{,-old}&lt;br /&gt;
&lt;br /&gt;
Now create a new tarball:&lt;br /&gt;
 [HN]# cd /vz/private/555&lt;br /&gt;
 [HN]# tar czf /vz/template/cache/debian-4.0-i386-minimal.tar.gz .&lt;br /&gt;
&lt;br /&gt;
Clean up:&lt;br /&gt;
 [HN]# vzctl destroy 555&lt;br /&gt;
 [HN]# rm -f /etc/vz/conf/555.conf.destroyed&lt;br /&gt;
&lt;br /&gt;
== Test new template cache ==&lt;br /&gt;
&lt;br /&gt;
First, compare the sizes of the old and the new template caches:&lt;br /&gt;
 [HN]# ls -lh /vz/template/cache/debian-4.0-i386-minimal*&lt;br /&gt;
 -rw-r--r-- 1 root root  55M 2007-11-13 18:11 /vz/template/cache/debian-4.0-i386-minimal.tar.gz&lt;br /&gt;
 -rw-r--r-- 1 root root  53M 2007-08-31 02:46 /vz/template/cache/debian-4.0-i386-minimal.tar.gz-old&lt;br /&gt;
The sizes should not differ much.&lt;br /&gt;
&lt;br /&gt;
Try to create and start container made from your new template:&lt;br /&gt;
 [HN]# vzctl create 222 --ostemplate debian-4.0-i386-minimal&lt;br /&gt;
 [HN]# vzctl set 222 --ipadd 10.0.0.222 --save&lt;br /&gt;
 [HN]# vzctl start 222&lt;br /&gt;
 [HN]# vzctl enter 222&lt;br /&gt;
&lt;br /&gt;
Now execute a few basic commands to check container is fine. Examples are: &amp;lt;code&amp;gt;ps axf&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dpkg -l&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
&lt;br /&gt;
Finally, clean up the testing container:&lt;br /&gt;
 [HN]# vzctl stop 222&lt;br /&gt;
 [HN]# vzctl destroy 222&lt;br /&gt;
 [HN]# rm -f /etc/vz/conf/222.conf.destroyed&lt;br /&gt;
&lt;br /&gt;
[[Category: Templates]]&lt;br /&gt;
[[Category: Debian]]&lt;/div&gt;</summary>
		<author><name>SciFi-Bob</name></author>
		
	</entry>
</feed>