当前位置:  首页>> 技术小册>> 虚拟化之KVM实战

宿主机主要为虚拟机提供硬件资源,要尽可能将硬件资源都给VM,所以尽量不要在宿主机和VM中混合跑程序。

宿主机硬件配置

  1. Lenovo thinkcentre 7-4770 16G 240G固态

宿主机系统

  1. CentOS Linux release 8.1.1911 (Core)

宿主机的要求

  1. 以下最小系统资源可用:
  2. 主机有6 GB的可用磁盘空间,每个预期的VM还有6 GB的可用磁盘空间。
  3. 2 GB用于主机的RAM,另外2 GB用于每个预期的VM

宿主机设置

a、BIOS中开启CPU VT技术

VT-D:如果BIOS中有就打开,优化IO

b、修改主机名

  1. [root@localhost ~]# echo "tyschool_com" > /etc/hostname

c、设置网络为静态IP,并能实现联网

  1. [root@localhost ~]# nmcli connection add con-name eno1 ifname eno1 ipv4.method manual \
  2. ipv4.addresses 192.168.1.200/24 ipv4.gateway 192.168.1.1 ipv4.dns 202.106.0.20 \
  3. +ipv4.dns 114.114.114.114 type 802-3-ethernet
  4. 连接 "eno1" (d1339ed8-c981-4103-b493-c5cf9dc6d28e) 已成功添加。

d、升级系统

  1. [root@localhost ~]# dnf update -y

e、关闭防火墙、关闭selinux

  1. #防火墙
  2. [root@localhost ~]# systemctl disable firewalld.service
  3. Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
  4. Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
  5. [root@localhost ~]# iptables -F
  6. [root@localhost ~]# iptables -t nat -F
  7. #selinux
  8. [root@localhost ~]# sed -r -i '/^(SELINUX)=(.*)/cSELINUX=disabled' /etc/selinux/config

f、重启生效

  1. [root@localhost ~]# reboot

该分类下的相关小册推荐: