Customize a LXC template ?

hugosxm

Member
Jul 23, 2014
46
0
6
Montpellier, France
Hi every body !

Can someone explain me how can i modify a template ?

i have downloaded the proxmox standard jessie template and i modified it to match my need, how can i create my own template from here ?

thanks for the answer :)

have a. Nice day
 
Ok thanks, i am trying to understand how it works.

so DAB can make a brand new template from a backup of my container ?

how can i do this ?

i understand that i have to do
dab finalize in the tar.gz of my existing container right ?
 
Last edited:
thanks for the link, i was reading this too : https://pve.proxmox.com/wiki/Build_your_first_DAB_Appliance_Template

as i understand those two articles this is what i have to do :

-get the jessie make file ( already done thanks to dietmar )
-make a deboostrap, do my changes in this deboostrap, install the packages that i need etc...
-then i make a tgz with the debootstrap
-then run DAB to turn the tgz in a real template

Can you agree with that ?

Or maybe i can do this :

-do a tgz of my existing customized lxc container with vzdump
-run DAB on this TGZ...

is this right too ?


i finally found this : https://pve.proxmox.com/wiki/Custom_built_template

i did a vzdump of my customized container and gived the tar.gz file to the pct create command, my lxc seems to work perfectly... is it a good way to do it ?
 
Last edited:
It is not working, here. I do not understand this and need a little bit help. I've copied the whole files from an container to another place on the PVEhost "/home/iso-images/template/cache/builds/testsystem" This images is customized. TMP, logs ... are deleted. So what now? When i say "dab bootstrap" it is creating a new system, when i say make it is creating a new system. So what grrrr. I would like to use my own build system as template. So how can i do this with all important things like create new sshkey an so on...

Thanks
 
Is there an up to date, simple guide that works anywhere on the Internet for this?

I've spent hours trying to figure out what should be I think quite simple.

Every bit of documentation I've found is years old and at some point in the steps just doesn't work.

The requirement is, get an existing (say Debian Jessie) template, modify it, save it as a new template. (LXC / Proxmox 4)

I see complex documentation involving building appliances (out of date / fails to work), hacks like the one above (out of date, doesn't work with LXC) instructions involving cloning KVMs and remounting file systems loop back etc. I see links to github,

It's basically like trying to solve some kind of treasure hunt/mystery hunting down clues, deciding which ones to ignore which ones may be helpful etc.

The guide linked to above was going nicely (all be it replacing vzctl with pct) until this step:

change directory to the virtual machines directory: cd /var/lib/vz/private/CTID

So that seems to be a dead end.

Sorry if this sounds like a rant. Just frustrated that no-one has anything up to date on this that works that I can find.
 
Yes, i fixed it. It is too simple!

There is nothing really difficult to do. Delete all files you will (tmp, history...). After that make an tar.gz. Ready.
 
I'm not following? What is fixed where? I think you got it working with OpenVZ and Promox 3 but it doesn't work this way anymore... :(
 
Last edited:
I'm not following? What is fixed where? I think you got it working with OpenVZ and Promox 3 but it doesn't work this way anymore... :(
it is almost the same, like I already wrote.

Delete files they are not needed, or files you do not want to have in the template. Then generate an tar.gz and it's ready for LXC too. The really difficult thing is to do an template from an existing System like PHY or KVM. But when you would like to customize an Template, then it is easy.
 
Thanks for your sticking with me here, I'm clearly missing something obvious.

When I stop my container I have no files in /var/lib/vz/private where should I be looking for them?
 
I think I missed the part in your post about vzdump....I may have it! It was something obvious...
 
Thanks for your sticking with me here, I'm clearly missing something obvious.
When I stop my container I have no files in /var/lib/vz/private where should I be looking for them?
Nothing? What storagemodel do you are using for?
 
Hello Guys,

You speak about delete files in the container, but if I want the inverse : I want to setup snmp with my config, and when I deploy a LXC template, snmp is well configured with my community, and other config, how can I do this ?
 
Hello Guys,
You speak about delete files in the container, but if I want the inverse : I want to setup snmp with my config, and when I deploy a LXC template, snmp is well configured with my community, and other config, how can I do this ?
not thinking too complicated... you can build anything in you template... no rules (anything that is possible, so for example, not NFS)
 
Nothing? What storagemodel do you are using for?

I just installed proxmox using latest version iso into a VM. It is using LVM as standard config (there are two disks local (pve) with the templates on and local-lvm (pve) with the disk images.

I still haven't managed to get this to work, I tried taking a backup, and then copying that from /var/lib/vz/dump and then moving that to /var/lib/lxc/100/rootfs and zipping that all up, but this didn't work.

I still never get anything in /var/lib/vz/private, in fact I don't know where the file system is at all when the container is not running...
 
@Jellifish
Sorry, i don't know how LXC is working on this storagemodel, is use it with ZFS. But normaly it should work the same. But I think because someone else can help you better to continue .
 
i will try it to explain it in english:

1) download a normal lxc / openvz template
2) create an lxc container with this template
3) boot it
4) open it (pct enter <id>)
5) install / modificat everything you want
6) remove all network interfaces
7) shutdown the container
8) make a backup with vzdump an select tar.gz
9) move an rename the backupfile from ...../dump/xyz.tar.gz to ..... /templates/cache/name-version.tar.gz
10) use your new template as any other




sorry for my bad english
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!