Creating an OpenVZ Template From an Existing VPS

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:

  1. vzctl stop [vps id]
  2. Create /tmp/vz-template-exclude.txt and add these lines to it:
    • .bash_history
    • lost+found
    • /dev/*
    • /mnt/*
    • /tmp/*
    • /proc/*
    • /sys/*
    • /usr/src/*
  3. tar –numeric-owner -czvf /vz/template/cache/template-name.tar.gz -X /tmp/vz-template-exclude.txt /vz/private/[vps id]
  4. cp /etc/vz/dists/centos.conf /etc/vz/dists/template-name.conf
  5. vzctl start [vps id]

Leave a Reply

Your email address will not be published. Required fields are marked *