在Ubuntu的命令行终端里管理KVM虚拟机的教程

2020-02-03 14:27:46王振洲

对于虚拟机来说,它的配置信息被存储在它对应的xml文件中。因此,创建一个虚拟机的第一步就是准备一个与虚拟机对应的 xml 文件。

下面是一个示例 xml 文件,你可以根据需要手动修改它。

  1. <domain type='kvm'>        <name>alice</name>  
  2.      <uuid>f5b8c05b-9c7a-3211-49b9-2bd635f7e2aa</uuid>        <memory>1048576</memory>  
  3.      <currentMemory>1048576</currentMemory>        <vcpu>1</vcpu>  
  4.      <os>          <type>hvm</type>  
  5.        <boot dev='cdrom'/>        </os>  
  6.      <features>          <acpi/>  
  7.      </features>        <clock offset='utc'/>  
  8.      <on_poweroff>destroy</on_poweroff>        <on_reboot>restart</on_reboot>  
  9.      <on_crash>destroy</on_crash>        <devices>  
  10.        <emulator>/usr/bin/kvm</emulator>          <disk type="file" device="disk">  
  11.          <driver name="qemu" type="raw"/>            <source file="/home/dev/images/alice.img"/>  
  12.          <target dev="vda" bus="virtio"/>            <address type="pci" domain="0x0000" bus="0x00" slot="0x04" function="0x0"/>  
  13.        </disk>          <disk type="file" device="cdrom">  
  14.          <driver name="qemu" type="raw"/>            <source file="/home/dev/iso/CentOS-6.5-x86_64-minimal.iso"/>