[libvirt-users] KVM guest creation - no manual interference

Brian Roberg robergb at dm.org
Fri Sep 10 17:24:26 UTC 2010


On Fri, Sep 10, 2010 at 11:51 AM, Jon Dowland
<jon+libvirt-users at alcopop.org> wrote:

> On Fri, Sep 10, 2010 at 11:16:14AM -0300, Lucas Arbiza wrote:
> > I've looking for a way to create KVM virtual machines completely automated
> > without the need to interact with guest operating system during
> > installation.
> >
> > With ubuntu-vm-builder is possible create the guest, list packages to be
> > installed and scripts to be run. Is there a way to do something like it with
> > libvirt?

I experimented only briefly with vmbuilder, so I'm no expert. But if
what you're asking is how to create libvirt-managed VMs using
vmbuilder, I think this page gives you what you need to get started:

https://help.ubuntu.com/10.04/serverguide/C/jeos-and-vmbuilder.html

> I haven't built any Debian/Ubuntu VMs yet, but I would basically do the same
> thing but using debconf preseeding for automated Debian installations.

This is what I've done to automate installation of our Ubuntu VMs.
I've been using command-line tools rather than virt-manager, so I'm
using virt-install to create the VM. By telling virt-install where to
look for certain information, I can initiate a fully automatic Ubuntu
install.

The key arguments to virt-install are these:
  --location=http://us.archive.ubuntu.com/ubuntu/dists/lucid/main/installer-amd64/
  --extra-args="url=http://127.0.0.1/custom.seed"

The first one tells virt-install where to find the Ubuntu installer.
(You might want to use a local mirror rather than ubuntu.com for
anything more than testing.) Pointing directly to the installer rather
than at an Ubuntu CD image lets you skip the prompt that you get upon
booting the CD before launching the installer.

The "extra-args" argument is passed along to the installer, and tells
the installer where to look for the debconf preseed file. You'll need
to tune that preseed file to exactly what you want. Ubuntu has some
good docs to help with that:
https://help.ubuntu.com/10.04/installation-guide/amd64/appendix-preseed.html

--
Brian

P.S. For anyone interested, I've posted the wrapper script I've
written to encapsulate the many arguments I pass to virt-install every
time: http://robergb.pastebin.com/VkXH2DH3

And here's my preseed file: http://robergb.pastebin.com/9GvHbAyu

I welcome any suggestions for improvements.




More information about the libvirt-users mailing list