centos7安装kvm虚拟机

一 centos7安装kvm虚拟机

1.验证CPU是否支持KVM

结果中有vmx(Intel)或svm(AMD)字样,就说明CPU的支持的。

[root@centos ~]# egrep '(vmx|svm)' /proc/cpuinfo

 

2.关闭selinux,设置防火墙

 关闭SELinux,将 /etc/sysconfig/selinux 中的 SELinux=enforcing 修改为 SELinux=disabled 

 

3. 安装KVM及其依赖项

yum install qemu-kvm libvirt virt-install bridge-utils -y

4.验证安装结果

查看kvm虚拟化模块是否加载

lsmod | grep kvm

 

5.启动libvirtd且设置其开机启动

systemctl start libvirtd

systemctl enable libvirtd

6.  配置网桥模式

a. 创建 ifcfg-br0 文件

[root@centos network-scripts][root@centos ~]#  cat ifcfg-br0

BOOTPROTO=static

DEVICE=br0

TYPE=Bridge

IPADDR=192.168.100.89

NETMASK=255.255.255.0

GATEWAY=192.168.100.254

DNS1=114.114.114.114

[root@centos network-scripts][root@centos ~]#  

b. 移除原来的 ifcfg-eth0 ,重新创建eth0文件

[root@centos network-scripts][root@centos ~]#  cat ifcfg-eth0

BOOTPROTO=none

DEVICE=eth0

NM_CONTROLLED=no

ONBOOT=yes

BRIDGE=br0

[root@centos network-scripts][root@centos ~]# 

c. 重启network网络服务

[root@centos ~]# systemctl restart network

d. ifconfig 验证操作结果,查看是否多了一块网卡br0

 

posted @ 2019-01-30 09:29  精灵中的二丫  阅读(340)  评论(0)    收藏  举报