virsh

ubuntu18

sudo apt-get install virt-manager

创建文件

qemu-img create image/win.qcow2 100g

配置文件

    <domain type='kvm'>
        <name>test1_ubuntu</name> //虚拟机名称
        <memory>2048576</memory> //最大内存,单位k
        <currentMemory>1048576</currentMemory> //可用内存,单位k
        <vcpu>1</vcpu> //虚拟cpu个数
        <os>
          <type arch='x86_64' machine='pc'>hvm</type>
          <boot dev='cdrom'/> //光盘启动
       </os>
       <features>
         <acpi/>
         <apic/>
         <pae/>
       </features>
       <clock offset='localtime'/>
       <on_poweroff>destroy</on_poweroff>
       <on_reboot>restart</on_reboot>
       <on_crash>destroy</on_crash>
       <devices>
         <emulator>/usr/bin/qemu-system-x86_64</emulator>
         <disk type='file' device='disk'>
          <driver name='qemu' type='raw'/>
           <source file='/home/ubuntu/installwin/image/win.qcow2'/> //目的镜像路径
           <target dev='hda' bus='ide'/>
         </disk>
         <disk type='file' device='cdrom'>
		 <source file='/home/ubuntu/installwin/Windows-10.iso'/> //光盘镜像路径
           <target dev='hdb' bus='ide'/>
         </disk>
        <input type='mouse' bus='ps2'/>
         <graphics type='vnc' port='-1' listen = '0.0.0.0' keymap='en-us'/>//vnc方式登录,端口号自动分配,自动加1,可以通过virsh vncdisplay来查询
       </devices>
     </domain> 

sudo virsh create win10.xml
sudo apt install gvncviewer
installwin/
├── image
│   └── win.qcow2
├── win10.xml
└── Windows-10.iso
posted @ 2020-03-20 14:46  人微言轻1  阅读(338)  评论(0编辑  收藏  举报