Editing Updating Debian template

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
 
This article describes how you can update an existing precreated Debian or Ubuntu template. The procedure is pretty easy.
 
This article describes how you can update an existing precreated Debian or Ubuntu template. The procedure is pretty easy.
  
== Creating/configuring a temporary container ==
+
== Creating/configuring a temporary VE ==
  
First, you need to create a container based on the template you want to update. Here is an example:
+
First, you need to create a VE based on the template you want to update. Here is an example:
  
 
  [HN]# vzctl create 555 --ostemplate debian-4.0-i386-minimal
 
  [HN]# vzctl create 555 --ostemplate debian-4.0-i386-minimal
Line 10: Line 10:
 
  [HN]# vzctl set 555 --ipadd x.x.x.x --nameserver y.y.y.y --save
 
  [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 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.
+
You can get the value of nameserver from your /etc/resolv.conf. Your VE should have an Internet access, so you either supply a public IP, or see [[using NAT for VE with private IPs]] for information about how to use private IP and NAT.
  
Then start your container:
+
Finally, check that Internet is working from inside a VE:
[HN]# vzctl start 555
+
  [HN]# vzctl exec 555 ping -n 3 www.ru
 
 
Finally, check that Internet is working from inside your container:
 
  [HN]# vzctl exec 555 ping -n -c 1 www.ru
 
  
 
== Update ==
 
== Update ==
 
   
 
   
Enter the container:
+
Enter the VE:
 
  [HN]# vzctl enter 555
 
  [HN]# vzctl enter 555
  
 
Update metadata and install updates:
 
Update metadata and install updates:
  [container]# apt-get update && apt-get upgrade
+
  [VE]# apt-get update && apt-get upgrade
  
 
Cleanup:
 
Cleanup:
  [container]# apt-get clean
+
  [VE]# apt-get clean
  [container]# > /etc/resolv.conf
+
  [VE]# > /etc/resolv.conf
  
Clean unused log files, .bash_history etc, then exit from a container:
+
Clean unused log files, .bash_history etc, then exit from a VE:
  [container] # exit
+
  [VE] # exit
  
Stop a container, remove its IP:
+
Stop a VE, remove its IP:
 
  [HN]# vzctl stop 555
 
  [HN]# vzctl stop 555
 
  [HN]# vzctl set 555 --ipdel all --save
 
  [HN]# vzctl set 555 --ipdel all --save
Line 41: Line 38:
 
Now, rename the existing template cache:
 
Now, rename the existing template cache:
 
  [HN]# mv /vz/template/cache/debian-4.0-i386-minimal.tar.gz{,-old}
 
  [HN]# 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:
 
Now create a new tarball:
  [HN]# tar --numeric-owner -czf /vz/template/cache/debian-4.0-i386-minimal.tar.gz .
+
[HN]# cd /vz/private/555
 +
  [HN]# tar czf /vz/template/cache/debian-4.0-i386-minimal.tar.gz .
  
 
Clean up:
 
Clean up:
[HN]# vzctl umount 555
 
 
  [HN]# vzctl destroy 555
 
  [HN]# vzctl destroy 555
 
  [HN]# rm -f /etc/vz/conf/555.conf.destroyed
 
  [HN]# rm -f /etc/vz/conf/555.conf.destroyed
Line 62: Line 55:
 
The sizes should not differ much.
 
The sizes should not differ much.
  
Try to create and start container made from your new template:
+
Try to create and start VE made from your new template:
 
  [HN]# vzctl create 222 --ostemplate debian-4.0-i386-minimal
 
  [HN]# vzctl create 222 --ostemplate debian-4.0-i386-minimal
 
  [HN]# vzctl set 222 --ipadd 10.0.0.222 --save
 
  [HN]# vzctl set 222 --ipadd 10.0.0.222 --save
Line 68: Line 61:
 
  [HN]# vzctl enter 222
 
  [HN]# 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 are: <code>ps axf</code>, <code>dpkg -l</code>, etc.
  
Finally, clean up the testing container:
+
Finally, clean up the testing VE:
 
  [HN]# vzctl stop 222
 
  [HN]# vzctl stop 222
 
  [HN]# vzctl destroy 222
 
  [HN]# vzctl destroy 222

Please note that all contributions to OpenVZ Virtuozzo Containers Wiki may be edited, altered, or removed by other contributors. If you don't want your writing to be edited mercilessly, then don't submit it here.
If you are going to add external links to an article, read the External links policy first!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)