zoukankan      html  css  js  c++  java
  • libvirt创建KVM虚拟机

    1 安装虚拟化相关组件

    yum -y install qemu-img qemu-kvm  libvirt

    2 启动libvirt服务

    systemctl  start libvirtd

    3 配置xml,创建空镜像

    qemu-img create -f qcow2  test.qcow2  20G
    <domain type='kvm'> 
        <name>test_jkk</name> 
        <memory>1048576</memory> 
        <currentMemory>1048576</currentMemory>
        <vcpu>1</vcpu>
        <os> 
          <type arch='x86_64' machine='pc'>hvm</type> 
          <boot dev='cdrom'/>
    <boot dev='hd'/> </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/libexec/qemu-kvm</emulator> <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/home/kvm/test.qcow2'/> <target dev='hda' bus='ide'/> </disk> <disk type='file' device='cdrom'> <source file='/home/kvm/centos_minimal.iso'/> <target dev='hdb' bus='ide'/> </disk> <interface type='bridge'> <source bridge='virbr0'/> </interface> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen = '0.0.0.0' keymap='en-us'/> </devices> </domain>

    4  定义启动虚拟机

    virsh define test.xml
    virsh start  test_jkk
    virsh  vncdisplay   test_jkk  查看虚拟机vnc串口
    virsh domblklist demo 查看虚拟机的磁盘文件
    virsh dumpxml demo 查看虚拟机xml
  • 相关阅读:
    ‘Host’ is not allowed to connect to this mysql server
    centos7安装mysql
    further configuration avilable 不见了
    Dynamic Web Module 3.0 requires Java 1.6 or newer
    hadoop启动 datanode的live node为0
    ssh远程访问失败 Centos7
    Linux 下的各种环境安装
    Centos7 安装 python2.7
    安装scala
    Centos7 安装 jdk 1.8
  • 原文地址:https://www.cnblogs.com/jkklearn/p/11923710.html
Copyright © 2011-2022 走看看