I like to use the vm-tools for quick VM cloning, but once in awhile i need to create a new VM from scratch. With vmbuilder being deprecated, I wanted something more convenient than manually installing from iso.
It’s pretty specifically tailered to what I want. It uses (by default) my preseed which assumes that apt-cache-ng is installed on the host, so I can minimize my net traffic. It downloads the mini.iso for a specified release, extracts the kernel and initrd, then runs kvm with a boot append line specifying to use my preseed to install a minimal server. Example usage:
make_kvm_vm -d ~/new-o-vm1.iso
By default it installs oneiric (‘-r lucid’ to specify) and forms the iso and virtual disk name based on the specified release (i.e. $HOME/$release.img and http://archive.ubuntu.com/ubuntu/dists/$release/main/installer-amd64/current/images/netboot/mini.iso.
Note! Vmbuilder has the advantage over this script in that it never requires running kvm, so can be run anywhere. But this script serves me well.