KVM Templates
-
How is the best way to create a KVM template?
Google Fu doesn't seem to be helping
-
@aaronstuder what is a ākvm templateā?
Just script your virt-install and use a script to clone the base image.
-
Here's an example of creating templates.
https://dnaeon.github.io/creating-a-template-for-kvm-virtual-machines/ -
There's a couple ways. You could either create the VM manually and do your setup and then clone it later, or use
virt-builder
to pull in pre-built images. I usually go for virt-builder. The images are smaller and have things preset for KVM (like console access on ttyS0).Just as a side note, one cool thing you can do with your templates is inject updated packages. Just do
virt-customize --update --selinux-relabel
on your template and it will update the packages inside and relabel SELinux (obv only use if it's a RHEL based VM). -
@stacksofplates Interesting. Can you tell me more about this?
-
Is there web portal repo for virt-builder ?
And ever heard of RawHide VM? WTF is that ?
-
@emad-r said in KVM Templates:
Is there web portal repo for virt-builder ?
-
@black3dynamite said in KVM Templates:
@emad-r said in KVM Templates:
Is there web portal repo for virt-builder ?
Very nice thanks.
-
@aaronstuder said in KVM Templates:
@stacksofplates Interesting. Can you tell me more about this?
Which part?
-
@stacksofplates building templates using virt-builder
-
@aaronstuder said in KVM Templates:
@stacksofplates building templates using virt-builder
Oh. It's pretty simple.
virt-builder --list
gives you a list of images you can use.Then just create your template with
virt-builder <os> --format <format> imagename.format
Then you can use virt-customize to inject packages, create users, set passwords, etc. Then just clone that for your template.
-
After a specific amount of time, it will download a new image and cache it when running
virt-builder
. I forget what the amount of time is though. -
@stacksofplates That's cool, virt-customize has an option to copy files or directories into the image.
-
@black3dynamite said in KVM Templates:
@stacksofplates That's cool, virt-customize has an option to copy files or directories into the image.
Ya, libguestfs has a bunch of cool tools.
-
@stacksofplates said in KVM Templates:
@aaronstuder said in KVM Templates:
@stacksofplates building templates using virt-builder
Oh. It's pretty simple.
virt-builder --list
gives you a list of images you can use.Then just create your template with
virt-builder <os> --format <format> imagename.format
Then you can use virt-customize to inject packages, create users, set passwords, etc. Then just clone that for your template.
Is it necessary to add
--selinux-relabel
when downloading the VM? -
@black3dynamite said in KVM Templates:
@stacksofplates said in KVM Templates:
@aaronstuder said in KVM Templates:
@stacksofplates building templates using virt-builder
Oh. It's pretty simple.
virt-builder --list
gives you a list of images you can use.Then just create your template with
virt-builder <os> --format <format> imagename.format
Then you can use virt-customize to inject packages, create users, set passwords, etc. Then just clone that for your template.
Is it necessary to add
--selinux-relabel
when downloading the VM?No. Thatās all in the image. Only when updating the packages with libguestfstools