Thought I would throw this out for those who are interested. I am by no means an expert, so if there are any comments or improvements I welcome them. This is the method I use for creating custom templates.
As of Proxmox 1.4, template naming must conform to the following schema:
<OS>-<OSVERSION>-<NAME>_<VERSION>_<ARCH>.tar.gz
For Example: "ubuntu-8.04-standard_8.04-1_i386.tar.gz"
Note: Watch the usage of "-" and "_" in the naming schema.
Architecture
Step 1) Create a virtual machine using whatever template you like.
Step 2) enter the virtual machine (vzctl enter CTID)
where CTID is the ID of the virtual machine
Step 3) Install/remove any software you want
Step 4) Exit out of the virtual machine (but do not stop it)
Step 5) remove the ip address from the virtual machine
vzctl set CTID --ipdel all --save
or use the web interface to remove the ip address
Step 6) Stop the virtual machine
vzctl stop CTID
or use the web interface
Step 7) change directory to the virtual machines directory
cd /var/lib/vz/private/CTID
Step 8) tar the directory
tar –czvf /var/lib/vz/template/cache/<template name>.tar.gz .
Note: the commands ends with a space followed by a period
Make sure you are in the directory for the virtual container
(/var/lib/vz/private/CTID)
Now you have a new template to use.
These instructions are largely borrowed from:
http://wiki.openvz.org/Centos_template
If you use yum to install software make sure to run "yum clean all" before you stop the virtual machine. Also if you want to exclude certain directories you can use the -X options with tar.
I exclude the following directories:
.bash_history
lost+found
tmp/*
src/*
usr/src/*
Be careful to set the directory path correctly when using an exclude file. You want to make sure that they are all pointing to CTID directory not the directories that are in the host system.
Hope this helps.
As of Proxmox 1.4, template naming must conform to the following schema:
<OS>-<OSVERSION>-<NAME>_<VERSION>_<ARCH>.tar.gz
For Example: "ubuntu-8.04-standard_8.04-1_i386.tar.gz"
Note: Watch the usage of "-" and "_" in the naming schema.
Architecture
- 32-bit templates should use i386 for ARCH
- 64-bit templates should use amd64 for ARCH
Step 1) Create a virtual machine using whatever template you like.
Step 2) enter the virtual machine (vzctl enter CTID)
where CTID is the ID of the virtual machine
Step 3) Install/remove any software you want
Step 4) Exit out of the virtual machine (but do not stop it)
Step 5) remove the ip address from the virtual machine
vzctl set CTID --ipdel all --save
or use the web interface to remove the ip address
Step 6) Stop the virtual machine
vzctl stop CTID
or use the web interface
Step 7) change directory to the virtual machines directory
cd /var/lib/vz/private/CTID
Step 8) tar the directory
tar –czvf /var/lib/vz/template/cache/<template name>.tar.gz .
Note: the commands ends with a space followed by a period
Make sure you are in the directory for the virtual container
(/var/lib/vz/private/CTID)
Now you have a new template to use.
These instructions are largely borrowed from:
http://wiki.openvz.org/Centos_template
If you use yum to install software make sure to run "yum clean all" before you stop the virtual machine. Also if you want to exclude certain directories you can use the -X options with tar.
I exclude the following directories:
.bash_history
lost+found
tmp/*
src/*
usr/src/*
Be careful to set the directory path correctly when using an exclude file. You want to make sure that they are all pointing to CTID directory not the directories that are in the host system.
Hope this helps.
Last edited: