-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Ubuntu Server Cookbook
By :
In the previous recipe, we saw how to start and manage virtual machines with KVM. This recipe covers the use of Virsh and virt-install to create and manage virtual machines. The libvirt Linux library exposes various APIs to manage hypervisors and virtual machines. Virsh is a command-line tool that provides an interface to libvirt APIs.
To create a new machine, Virsh needs the machine definition in XML format. virt-install is a Python script to easily create a new virtual machine without manipulating bits of XML. It provides an easy-to-use interface to define a machine, create an XML definition for it and then load it in Virsh to start it.
In this recipe, we will create a new virtual machine with virt-install and see how it can be managed with various Virsh commands.
You will need access to the root account or an account with sudo privileges.
Install the required packages, as follows:
$ sudo apt-get update $ sudo apt-get install -y qemu-kvm libvirt...