ubuntu-kvm上面deploy qcow2格式虚拟机

ubuntu-kvm完成后,将xxx.qcow2格式的镜像拷贝到ubuntu-kvm这个虚拟机上面去。

1. 若是ubuntu server没有图形界面,可以先安装desktop,参考http://www.cnblogs.com/kex1n/p/5198480.html

安装完成后,参考http://www.howtogeek.com/117635/how-to-install-kvm-and-create-virtual-machines-on-ubuntu/ 用xxx.qcow2进行create virtual machine。

(choose how would you like to install the operating system---import existing disk image)。

执行

$ sudo apt-get install virt-manager

安装virt-manager。

如果不用图形界面而用命令行在kvm虚拟机上创建virtual machine,参考

http://blog.allanglesit.com/2011/03/kvm-guests-using-virt-install-to-import-an-existing-disk-image/

https://help.ubuntu.com/community/KVM/CreateGuests

2. 此时启动virtual machine可能会报错,解决办法参考:http://ubuntuforums.org/showthread.php?t=1638708

具体步骤如下:

/etc/libvirt/qemu/youVmname.xml修改:

From   
<devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/storage/vmimages/Windows7_x64-01/qcow2-60GB_HDD1.qcow2'/>
      <target dev='hda' bus='ide'/>
    </disk>
To
<devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/storage/vmimages/Windows7_x64-01/qcow2-60GB_HDD1.qcow2'/>
      <target dev='hda' bus='ide'/>
    </disk>
3.

# virsh

#connect qemu:///system

# define /etc/libvirt/qemu/newave.xml

# list --all

# start youVmname

# virt-manager

4. OK,剩下的就是配置virtual machine的网络了。