Board logo

标题: CentOS8安装KVM [打印本页]

作者: admin    时间: 2020-8-14 17:05     标题: CentOS8安装KVM

笺注:这是在 CentOS8安装图形界面 的基础上进行的。 VMware Workstation要启用虚拟化引擎: 图片1.png 安装network服务: [root@redhat8 ~]# yum -y install network-scripts 开机自动开启network服务 [root@redhat8 ~]# systemctl enable network 备注:实验中,服务器有两张物理网卡 虚拟网桥的配置: [root@redhat8 ~]# cat /etc/sysconfig/network-scripts/ifcfg-br0 DEVICE=br0 ONBOOT=yes BOOTPROTO=static IPADDR="192.168.168.155" NETMASK="255.255.255.0" GATEWAY="192.168.168.2" DNS1="8.8.8.8" DNS2="114.114.114.114" USERCTL=no TYPE=Bridge 网卡bonding的配置: [root@redhat8 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0 DEVICE=bond0 ONBOOT=yes BONDING_OPTS="mode=1 miimon=100 fail_over_mac=1" BRIDGE="br0" 两张物理网卡的配置: [root@redhat8 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens160 DEVICE=ens160 ONBOOT=yes SLAVE=yes USERCTL=no BOOTPROTO=static MASTER=bond0 [root@redhat8 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens224 DEVICE=ens224 ONBOOT=yes SLAVE=yes USERCTL=no BOOTPROTO=static MASTER=bond0 重启network服务后,修改生效: [root@redhat8 ~]# systemctl restart network 网卡bonding、虚拟网桥配置成功: [root@redhat8 ~]# ifconfig bond0: flags=5187 mtu 1500 ether 00:0c:29:e1:fb:fc txqueuelen 1000 (Ethernet) RX packets 4412 bytes 2695180 (2.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 115 bytes 15731 (15.3 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 br0: flags=4163 mtu 1500 inet 192.168.168.155 netmask 255.255.255.0 broadcast 192.168.168.255 inet6 fe80::c467:77ff:fe63:3fa4 prefixlen 64 scopeid 0x20 ether 00:0c:29:e1:fb:fc txqueuelen 1000 (Ethernet) RX packets 458 bytes 32352 (31.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 119 bytes 16043 (15.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ens160: flags=4163 mtu 1500 ether 00:0c:29:e1:fb:f2 txqueuelen 1000 (Ethernet) RX packets 28 bytes 3211 (3.1 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ens224: flags=6211 mtu 1500 ether 00:0c:29:e1:fb:fc txqueuelen 1000 (Ethernet) RX packets 2223 bytes 1500010 (1.4 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 33 bytes 3606 (3.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 248 bytes 51472 (50.2 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 248 bytes 51472 (50.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 查看bond0接口的状态: [root@redhat8 ~]# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: fault-tolerance (active-backup) (fail_over_mac active) Primary Slave: None Currently Active Slave: ens160 #可以看到网卡ens160处于活跃状态 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 Peer Notification Delay (ms): 0 Slave Interface: ens160 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:0c:29:e1:fb:f2 Slave queue ID: 0 Slave Interface: ens224 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:0c:29:e1:fb:fc Slave queue ID: 0 以下是测试两张网卡的自动切换:( 正常的话,当网卡ens160 down了之后,当前活跃的网卡会自动变为ens224 ) [root@redhat8 ~]# ifdown ens160 WARN : [ifdown] You are using 'ifdown' script provided by 'network-scripts', which are now deprecated. WARN : [ifdown] 'network-scripts' will be removed in one of the next major releases of RHEL. WARN : [ifdown] It is advised to switch to 'NetworkManager' instead - it provides 'ifup/ifdown' scripts as well. 成功断开设备 "ens160"。 [root@redhat8 ~]# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: fault-tolerance (active-backup) (fail_over_mac active) Primary Slave: None Currently Active Slave: ens224 #可以看到网卡ens224处于活跃状态 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 Peer Notification Delay (ms): 0 Slave Interface: ens224 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:0c:29:e1:fb:fc Slave queue ID: 0 安装KVM: [root@redhat8 ~]# dnf -y install @virt 验证KVM是否安装成功: lsmod | grep kvm 图片1.png 安装虚拟机管理工具: [root@redhat8 ~]# dnf -y install virt-top libguestfs-tools 启动KVM守护程序libvirtd: [root@redhat8 ~]# systemctl enable --now libvirtd [root@redhat8 ~]# systemctl is-enabled libvirtd enabled [root@redhat8 ~]# ps -ef |grep libvirtd |grep -v grep root 1359 1 0 12:16 ? 00:00:02 /usr/sbin/libvirtd 安装virt-manager工具,该工具允许从GUI管理虚拟机: [root@redhat8 ~]# dnf -y install virt-manager 查看KVM版本的信息: virsh version 图片2.png 查看KVM节点(服务器)的信息: virsh nodeinfo 图片3.png #################### 打开 虚拟系统管理器 图片5.png 图片6.png 相关文章: CentOS8_KVM_Linux(创建虚拟机) CentOS8_网络基础(网卡bonding的配置) CentOS7.8安装KVM

图片附件: 图片1.png (2020-8-14 17:01, 50.83 KB) / 下载次数 167
http://blog.zhuohua.store/attachment.php?aid=10279&k=64e47dd0d959dce33fb86bb0682c68e8&t=1714392685&sid=631gkc



图片附件: 图片5.png (2020-8-14 17:03, 115.52 KB) / 下载次数 156
http://blog.zhuohua.store/attachment.php?aid=10283&k=3638ebf10abee15d95ea201190ed56b2&t=1714392685&sid=631gkc



图片附件: 图片6.png (2020-8-14 17:03, 23.14 KB) / 下载次数 148
http://blog.zhuohua.store/attachment.php?aid=10284&k=21c72ac01ad46dee198374e918300a64&t=1714392685&sid=631gkc



图片附件: 图片1.png (2020-10-13 13:40, 7.8 KB) / 下载次数 176
http://blog.zhuohua.store/attachment.php?aid=11871&k=d0e05164f2d578a5895f46c528d95c33&t=1714392685&sid=631gkc



图片附件: 图片2.png (2020-10-13 13:41, 9.86 KB) / 下载次数 177
http://blog.zhuohua.store/attachment.php?aid=11872&k=008cabc3fa764806474c854c64ae1ba9&t=1714392685&sid=631gkc



图片附件: 图片3.png (2020-10-13 13:41, 16.2 KB) / 下载次数 177
http://blog.zhuohua.store/attachment.php?aid=11873&k=229ec8d1e56d4d1fd96ece7649f81c13&t=1714392685&sid=631gkc






欢迎光临 blog.zhuohua.store (http://blog.zhuohua.store/) Powered by Discuz! 7.2