CentOS7安装KVM虚拟机

时间:2022-12-24 12:36:31

CentOS7安装KVM虚拟机

 

.前期准备

1.确定机器有VT 
终端输入命令:

grep'(vmx|svm)' /proc/cpuinfo

 

2.确保BIOS里开启VT:  Intel(R)Virtualization Tech [Enabled] 使用如下命令

lsmod | grep kvm 
modprobe kvm-intel
 

.桥接网络

打开 /etc/libvirt/qemu/networks/default.xml 修改虚拟网卡IP

 

.安装kvm

 

yum -y install libcanberra-gtk2 qemu-kvm.x86_64 qemu-kvm-tools.x86_64    libvirt.x86_64libvirt-cim.x86_64libvirt-client.x86_64 libvirt-java.noarch  libvirt-python.x86_64 libiscsi-1.7.0-5.el6.x86_64 dbus-devel  virt-clonetunctl virt-manager libvirt libvirt-python python-virtinst

 

让虚拟机开机自动启动   systemctl enable libvirtd    systemctl start libvirt

 

设置后可在/etc/libvirt/qemu/autostart下看到已设置自动启动KVM配置文件链接