• Ubuntu 10.04下使用 libvirt 创建KVM虚拟机


    配置网络

    vim /etc/network/interface 

    改为如下

    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # The primary network interface
    auto eth0
    iface eth0 inet manual

    auto br0 
    iface br0 inet dhcp //宿主机是vmware创建的,需要使用动态的IP
    bridge_ports eth0
    bridge_fd 0
    bridge_stp off
    bridge_maxwait 0

    编写setup.xml

    <domain type = 'kvm'>
    <name>test_ubuntu</name>
    <memory>1048576</memory>
    <currentMemory>1048576</currentMemory>
    <vcpu>1</vcpu>
    <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/kvm</emulator>
    <disk type = 'file' device = 'disk'>
    <driver name = 'qemu' type = 'raw'/>
    <source file = '/disks/ubuntu.raw'/>
    <target dev = 'hda' bud = 'ide'/>
    </disk>
    <disk type = 'file' device = 'cdrom'>
    <source file = '/iso/ubuntu-10.04.3-server-amd64.iso'/>
    <target dev = 'hdb' bus = 'ide'/>
    </disk>
    <interface type = 'bridge'>
    <source bridge = 'br0'/>
    <mac address = "00:16:3e:5d:aa:a8"/>
    </interface>
    <input type = 'mouse' bus = 'ps2'/>
    <graphics type = 'vnc' port = '-1' autoport = 'yes' keymap = 'en-us'/>
    </devices>
    </domain>

  • 相关阅读:
    属性的简单了解
    深入方法(29)- 传址参数不能赋予常量
    深入方法(27)- 递归函数: 简单示例
    MySQL 中文字符集排序
    Yii2 Apache + Nginx 路由重写
    DQL、DML、DDL、DCL的概念与区别
    php获取指定日期的前一天,前一月,前一年日期
    PHP 获取两个时间之间的月份
    PHP 调试工具Xdebug安装配置
    Nginx 反向代理、负载均衡
  • 原文地址:https://www.cnblogs.com/zhangzhang/p/2350993.html
Copyright © 2020-2023  润新知