快速搭建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连接
参考文章:(http://koumm.blog.51cto.com/703525/1289627)
本文出自 “龙斌雄” 博客,请务必保留此出处http://dragon123.blog.51cto.com/9152073/1620263
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。