Defining KVM instances
In this recipe, we are going to define a virtual instance by creating a simple XML configuration file that libvirt
can use to build the virtual machine. We are going to describe some of the XML schema blocks and look at examples of how to generate the XML definition file using the virt-install
command rather than writing it manually.
Getting ready
For this recipe, we are going to need the following:
- The QEMU binaries, provided after following the Installing and configuring QEMU recipe from Chapter 1, Getting Started with QEMU and KVM.
- The custom raw Debian image we built in the Installing a custom OS on the image with debootstrap recipe from the previous chapter.
Note
You can use your own virtual machine image or download one from the Internet, as we showed in the Using pre-existing images recipe in Chapter 1, Getting Started with QEMU and KVM.
How to do it...
To define a new KVM virtual machine, run the commands outlined here:
- List all virtual machines on the host OS:
root...