2021-05-12 14:32:11
快速搭建KVM及安裝Linux系統
快速搭建KVM及安裝Linux系統
1.安裝KVM核心及libvirtd相關元件
yum -y install kvm Python-virtinst libvirt tunctl bridge-utils virt-manager qemu-kvm-tools virt-viewer
2.載入KVM執行模組
[root@localhost ~]# modprobe kvm
[root@localhost ~]# modprobe -ls |grep kvm
kernel/arch/x86/kvm/kvm.ko
kernel/arch/x86/kvm/kvm-intel.ko
kernel/arch/x86/kvm/kvm-amd.ko
3.建立物理橋
virsh iface-bridge eth0 br0
檢視網路
[root@localhost ~]# ifconfig
br0 Link encap:Ethernet HWaddr 00:0C:29:C1:62:56
inet addr:192.168.150.136 Bcast:192.168.150.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec1:6256/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4925 errors:0 dropped:0 overruns:0 frame:0
TX packets:3937 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:532933 (520.4 KiB) TX bytes:13484199 (12.8 MiB)
eth0 Link encap:Ethernet HWaddr 00:0C:29:C1:62:56
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:377686 errors:0 dropped:0 overruns:0 frame:0
TX packets:110643 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:507725096 (484.2 MiB) TX bytes:66233641 (63.1 MiB)
4.建立一塊虛擬磁碟:
qemu-img create -f qcow2 /kvm/test003.img 5G
5.建立一個虛擬機器:
qcow2格式
[root@localhost ~]# virt-install --name test003 --ram 512
--vcpus=1 --disk path=/kvm/test003.img,size=5,format=qcow2,bus=virtio
--accelerate --cdrom /tmp/CentOS-6.6-x86_64-minimal.iso
--vnc --vncport=5910 --vnclisten=0.0.0.0
--network bridge=br0,model=virtio --noautoconsole
raw格式:
[root@localhost ~]# virt-install --name test003 --ram 512
--vcpus=1 --disk path=/kvm/test003.img,size=5,bus=virtio
--accelerate --cdrom /tmp/CentOS-6.6-x86_64-minimal.iso
--vnc --vncport=5910 --vnclisten=0.0.0.0
--network bridge=br0,model=virtio --noautoconsole
6.VNC連線
--------------------------------------分割線 --------------------------------------
Linux入門學習教學:虛擬機器體驗之KVM篇 http://www.linuxidc.com/Linux/2015-03/114462.htm
RHEL6 KVM虛擬化建立橋接網絡卡-網橋 http://www.linuxidc.com/Linux/2013-08/88517.htm
RedHat Linux KVM虛擬機器橋接 http://www.linuxidc.com/Linux/2013-02/79934.htm
CentOS 5.6下KVM的安裝/橋接設定/虛擬機器建立及執行 http://www.linuxidc.com/Linux/2012-12/76883.htm
Ubuntu下用libvirt安裝KVM虛擬機器時找不到/bin/qemu-kvm問題解決 http://www.linuxidc.com/Linux/2013-08/88985.htm
RedHat6.5下安裝設定KVM虛擬機器 http://www.linuxidc.com/Linux/2014-10/107972.htm
--------------------------------------分割線 --------------------------------------
本文永久更新連結地址:http://www.linuxidc.com/Linux/2015-03/115004.htm
相關文章