I recently setup a VPS on a new OpenVZ node and wanted to use it as a template for future VPS’s created on that node. The instructions in the wiki are actually overkill for this situation; here’s all I had to do:
- vzctl stop [vps id]
- Create /tmp/vz-template-exclude.txt and add these lines to it:
- .bash_history
- lost+found
- /dev/*
- /mnt/*
- /tmp/*
- /proc/*
- /sys/*
- /usr/src/*
- tar –numeric-owner -czvf /vz/template/cache/template-name.tar.gz -X /tmp/vz-template-exclude.txt /vz/private/[vps id]
- cp /etc/vz/dists/centos.conf /etc/vz/dists/template-name.conf
- vzctl start [vps id]