vim /boot/grub/grub.conf
default=1
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum install wget -y
yum -y install kvm python-virtinst libvirt tunctl bridge-utils virt-manager qemu-kvm-tools virt-viewer virt-v2v libguestfs-tools
systemctl start libvirtd
systemctl enable libvirtd
lsmod |grep kvm
virsh -version
systemctl stop NetworkManager
systemctl disable NetworkManager
[root@master1 network-scripts]# vim ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="yes"
NAME="ens33"
UUID="be9b026a-9fd9-46a0-881c-2af02b2c07e2"
DEVICE="ens33"
ONBOOT="yes"
BRIDGE="br0"
IPADDR="192.168.52.100"
PREFIX="24"
GATEWAY="192.168.52.2"
DNS1="192.168.52.2"
IPV6_PRIVACY="no"
[root@master1 network-scripts]# vim ifcfg-br0
BOOTPROTO="static"
NAME="ens33"
DEVICE="br0"
TYPE="Bridge"
ONBOOT="yes"
IPADDR="192.168.52.100"
PREFIX="24"
GATEWAY="192.168.52.2"
DNS1="192.168.52.2"
service network restart
echo 1 > /proc/sys/net/ipv4/ip_forward
vim /etc/security/limits.conf
* soft core unlimited
* hard core unlimited
* soft nproc 1000000
* hard nproc 1000000
* soft nofile 1000000
* hard nofile 1000000
* soft memlock 32000
* hard memlock 32000
* soft msgqueue 8192000
* hard msgqueue 8192000
yum install virt-manager libvirt libvirt-python python-virtinst libvirt-client libvirt-daemon-kvm -y
virt-manager
yum groupinstall "X Window System"
yum install -y dejavu-lgc-sans-fonts
yum groupinstall -y "Fonts"
virt-manager
需要重新打开窗口才能使用
--------------------------------------------------------------------------------------------------------------------
查看是否支持了虚拟化:cat /proc/cpuinfo | grep -E 'vmx|svm'(可跳过)
查看是否kvm的驱动已经加载:lsmod | grep kvm(可跳过)
如果没有加载kvm驱动,利用命令加载驱动
modprobe -a kvm
modprobe -a kvm_intel
安装qemu-kvm: yum install -y qemu-kvm
安装libvirt:
yum install -y libvirt
service libvirtd restart
验证libvirt是否正常启动: virsh version
安装virt-manager工具: yum install -y virt-manager
关闭xshell,重新连接,输入命令:virt-manager,就可以自动弹出kvm管理软件