Installing KVM Guests With virt-install On Ubuntu 11.10 Server - Page 3

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Thu, 2011-11-24 18:41. ::

6 Creating A CentOS 6.0 Guest (Image-Based) From The Desktop With virt-manager

Ubuntu 11.10 Desktop:

Instead of creating a virtual machine from the command line (as shown in chapter 4), you can as well create it from the Ubuntu desktop using virt-manager (of course, the virtual machine will be created on the Ubuntu 11.10 KVM host - in case you ask yourself if virt-manager is able to create virtual machines on remote systems).

To do this, click on the following button:

The New VM dialogue comes up. Fill in a name for the VM (e.g. vm11), select Local install media (ISO image or CDROM), and click on Forward:

Next select Linux in the OS type drop-down menu and Red Hat Enterprise Linux 6 in the Version drop-down menu, then check Use ISO image and click on the Browse... button:

Select the CentOS-6.0-x86_64-bin-DVD1.iso image that you created in chapter 4 and click on Choose Volume:

Now click on Forward:

Assign memory and the number of CPUs to the virtual machine and click on Forward:

Now we come to the storage. Check Enable storage for this virtual machine, select Create a disk image on the computer's hard drive, specify the size of the hard drive (e.g. 12GB), and check Allocate entire disk now. Then click on Forward:

Now we come to the last step of the New VM dialogue. Go to the Advanced options section. Select Specify shared device name; the Bridge name field will then appear where you fill in the name of your bridge (if you have used the Virtualization With KVM On Ubuntu 11.10 guide to set up the KVM host, this is br0). Click on Finish afterwards:

The disk image for the VM is now being created:

Afterwards, the VM will start. If you use a remote KVM host, type in the root password of the KVM host:

You should now be connected to the graphical console of the guest and see the CentOS installer:

Now install CentOS as you would normally do on a physical system.

 

7 Cloning Guests

Ubuntu 11.10 KVM Host:

The python-virtinst package comes with a second tool, virt-clone, that lets you clone guests. To clone vm10 and name the clone vm12 with the disk image /var/lib/libvirt/images/vm12.img, you simply run (make sure that vm10 is stopped!)

sudo virt-clone --connect qemu:///system -o vm10 -n vm12 -f /var/lib/libvirt/images/vm12.img

Afterwards, you can start vm12 with virt-manager or like this...

sudo virsh --connect qemu:///system

start vm12

quit

... and connect to it using virt-manager.

 

8 Links


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by maykel535 (registered user) on Tue, 2011-12-13 13:55.

Thanks for this tutorial. I suscribed in this page and I`m happy.

 I have install this tutorial but when exec:

 maykel@maykel-Vostro-230:~$ virsh --connect qemu:///system

 All ok.

 But:

maykel@maykel-Vostro-230:~$ virsh --connect qemu:///system

Bienvenido a virsh, la terminal de virtualización interactiva.


Ingrese: 'help' para obtener ayuda con los comandos

       'quit' para salir


virsh # list

 Id Nombre               Estado

----------------------------------

  6 ubuntu               running

  7 vm10                 running


virsh # shutdown ubuntu

El dominio ubuntu está siendo apagado


virsh # list

 Id Nombre               Estado

----------------------------------

  6 ubuntu               running

  7 vm10                 running

 
 I when executing shutdown ubuntu , the machine no shutdown. Why?
 

 Thanks in advanced.
Submitted by deftone (not registered) on Thu, 2011-12-01 22:31.

Why don't you use virt-manager's ability to create host, since you're still using it for installation?