Editing Updating Debian template
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 | + | == Creating/configuring a temporary VE == |
− | First, you need to create a | + | 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 | + | 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. |
− | + | Finally, check that Internet is working from inside a VE: | |
− | + | [HN]# vzctl exec 555 ping -n 3 www.ru | |
− | |||
− | Finally, check that Internet is working from inside | ||
− | [HN]# vzctl exec 555 ping -n | ||
== Update == | == Update == | ||
− | Enter the | + | Enter the VE: |
[HN]# vzctl enter 555 | [HN]# vzctl enter 555 | ||
Update metadata and install updates: | Update metadata and install updates: | ||
− | [ | + | [VE]# apt-get update && apt-get upgrade |
Cleanup: | Cleanup: | ||
− | [ | + | [VE]# apt-get clean |
− | [ | + | [VE]# > /etc/resolv.conf |
− | Clean unused log files, .bash_history etc, then exit from a | + | Clean unused log files, .bash_history etc, then exit from a VE: |
− | [ | + | [VE] # exit |
− | Stop a | + | 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} | ||
− | |||
− | |||
− | |||
− | |||
Now create a new tarball: | Now create a new tarball: | ||
− | [HN]# tar | + | [HN]# cd /vz/private/555 |
+ | [HN]# tar czf /vz/template/cache/debian-4.0-i386-minimal.tar.gz . | ||
Clean up: | Clean up: | ||
− | |||
[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 | + | 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 | + | 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 | + | Finally, clean up the testing VE: |
[HN]# vzctl stop 222 | [HN]# vzctl stop 222 | ||
[HN]# vzctl destroy 222 | [HN]# vzctl destroy 222 |