linux 下的KVM 虛擬機
阿新 • • 發佈:2018-07-28
machine lock graph -a ebo html 安裝 disk linux linux 下的kvm的使用
cpu開啟VT
安裝kvm套件
添加br0橋接網口
創建虛擬機磁盤,或者在安裝虛擬機的時候創建該磁盤。
安裝虛擬機
使用虛擬機
使用安裝的虛擬機磁盤做原始鏡像來啟動新的虛擬機
關閉安裝的虛擬機
復制安裝的虛擬機磁盤
重新define 一個虛擬機的xml文件,具體內容如下:
<domain type='kvm'> <name>vm01</name> <memory>4096000</memory> <currentMemory>4096000</currentMemory> <vcpu>2</vcpu> <os> <type arch='x86_64' machine='pc'>hvm</type> <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='/storage/instance/vm01/centos6.6.qcow2'/> <target dev='hda' bus='ide'/> </disk> <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/storage/instance/vm01/disk.qcow2'/> <target dev='hdb' bus='ide'/> </disk> <disk type='file' device='cdrom'> <source file='/iso/CentOS-6.6-x86_64-bin-DVD1.iso'/> <target dev='hdc' bus='ide'/> </disk> <interface type='bridge'> <source bridge='br0'/> </interface> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen = '0.0.0.0' keymap='en-us'/> </devices> </domain>
啟動剛創建的虛擬機
大功告成
linux 下的KVM 虛擬機