In my KVM presentation, I discussed how to create KVM guests using the virt-install utility. To create a KVM guest, you can run the virt-install utility with one or more options that control where the guest will be installed, how to install it, and how to structure the guest hardware profile . Here is one such example:
$ virt-install --connect qemu:///system
--name kvmnode1
--ram 512
--file /nfs/vms/kvmnode1.disk1
--file /nfs/vms/kvmnode1.disk2
--network=bridge:br0
--accelerate
-s 18
--pxe
-d
--noautoconsole
--mac=54:52:00:53:20:15
--nographics
--nonsparse
Under the covers virt-install executes qemu-kvm (at least on RHEL derives distributions), which is the process that is responsible for encapsulating the KVM guest in userspace. To start a guest using qemu-kvm, you can execute something similar to the following:
$ /usr/bin/qemu-kvm -M pc
-m 1024
-smp 1
-name kvmnode1
-monitor stdio
-boot n
-drive file=/nfs/vms/kvmnode1,if=ide,index=0
-net nic,macaddr=54:52:00:53:20:00,vlan=0
-net tap,script=no,vlan=0,ifname=tap0
-serial stdio
-nographic
-incoming tcp:0:4444
While virt-install is definitely easier to use, there are times when you may need to start a guest manually using qemu-kvm (certain options aren’t available through virt-install, so understanding how qemu-kvm works is key!). Viva la KVM!!!