系统 | IP |
---|---|
rhel7 | 192.168.160.111 |
文章目录
关闭防火墙和SElinux
[root@localhost ~]# systemctl restart firewalld
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Disabled
配置网络源
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS7-Base-163.repo
[root@localhost ~]# sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS7-Base-163.repo
[root@localhost ~]# sed -i 's/^enabled=.*/enabled=1/g' /etc/yum.repos.d/CentOS7-Base-163.repo
检查cpu是否支持KVM并安装KVM
[root@localhost ~]# egrep -o 'vmx|sv' /proc/cpuinfo
vmx
vmx
vmx
vmx
安装kvm
[root@localhost ~]# yum -y install qemu-kvm qemu-kvm-tools qemu-img virt-manager libvirt libvirt-python libvirt-client virt-install virt-viewer bridge-utils libguestfs-tools
设置桥接网卡
需要两张网卡
[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# cp ifcfg-ens33 ifcfg-br0
[root@localhost network-scripts]# vim ifcfg-br0
TYPE=Bridge
BOOTPROTO=static
IPV4_FAILURE_FATAL=no
NAME=br0
DEVICE=br0
ONBOOT=yes
NM_CONTROLLED=no
IPADDR=192.168.160.109
NETMASK=255.255.255.0
GATEWAY=192.168.160.1
DNS1=114.114.114.114
DNS2=8.8.8.8
[root@localhost network-scripts]# vim ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=ens33
UUID=af65f584-0fe3-456b-be69-7e097f41506a
DEVICE=ens33
ONBOOT=yes
BRIDGE=br0
NM_CONTROLLED=no
kvm web管理界面安装
[root@localhost ~]# yum -y install git python-pip libvirt-python libxml2-python python-websockify supervisor nginx python-devel
[root@localhost ~]# pip install --upgrade pip ##升级pip
[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# git clone git://github.com/retspen/webvirtmgr.git 从github上下载webvirtmgr代码
安装webvirtmgr
[root@localhost webvirtmgr]# pip install -r requirements.txt
[root@localhost webvirtmgr]# python ##检查sqlite3是否安装
Python 2.7.5 (default, Oct 30 2018, 23:45:53)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2
Type &#