O'Reilly logo

KVM Virtualization Cookbook by Konstantin Ivanov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

To define a new KVM virtual machine, run the commands outlined here:

  1. List all virtual machines on the host OS:
root@kvm:~# virsh list --all Id Name State----------------------------------------------------root@kvm:~#
  1. Create the following XML definition file:
root@kvm:~# cat kvm1.xml<domain type='kvm' id='1'> <name>kvm1</name> <memory unit='KiB'>1048576</memory> <vcpu placement='static'>1</vcpu> <os>   <type arch='x86_64' machine='pc-i440fx-trusty'>hvm</type>   <boot dev='hd'/> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices>   <emulator>/usr/bin/qemu-system-x86_64</emulator>   <disk type='file' device='disk'>     <driver name='qemu' type='raw'/> <source file='/tmp/debian.img'/> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required