The ubuntu server doco has a
pretty good howto.
To keep a record of your config and replicate it across multiple VMs you'll want to
use a config file. Then use this command:
sudo vmbuilder kvm ubuntu --domain=hostname \
--dest=/path/to/hostname-intrepid-amd64 \
-c thisconfig.cfg
Or if it's a one-off here's a version with most options on the commandline (you'll want to be changing that password soon):
sudo vmbuilder kvm ubuntu --dest=/data/kvm/temp-ubuntu-amd64 --bridge=br0 \
--mem=2048 -suite precise --flavour virtual --arch amd64 -o --libvirt qemu:///system \
--hostname temp-ubuntu-amd64 --part /usr/local/vms/templates/vmbuilder.partition \
--user user --name user --pass password
To edit a virtual machine's attributes you can just edit the xml under /etc/libvirt/ and then restart libvirt but
the supported way is better because it tells you about any errors:
$ virsh dumpxml foo > /tmp/foo.xml
(edit /tmp/foo.xml as needed)
$ virsh define /tmp/foo.xml
The networking configuration is
hereSomehow I ended up with VMs using the same port numbers for their display, giving this error:
bind() failed
It took me a while to track this down (BTW: virt-manager logs to ~/.virt-manager and the kvm server logs into /var/log/libvirt). Just had to change the port numbers with dump/define above in the machine config and all was well.
To connect to the console, use VNC to localhost, or you can install virt-viewer, which basically does the same:
sudo apt-get install virt-viewer
sudo virt-viewer my_vm_name