安装libvirt
前置条件参考
命令行安装创建kvm
virt-install --virt-type kvm --name test2 --ram 1024 --vcpus=2 --cdrom=/iso/CentOS-7-x86_64-DVD-2009.iso --disk /images/secondVM.qcow2,format=qcow2 --network network=default --graphics vnc,listen=0.0.0.0 --noautoconsole --os-type=linux
查看存在的虚拟机。 virsh常用命令
查看名为test2虚拟机占用的端口
[root@localhost hanw]# virsh vncdisplay test2
:1
查看当前的iptables情况(yum install iptables* -y)
[root@localhost hanw]# iptables -nL
放行5900端口
iptables -A INPUT -p tcp -m tcp --dport 5900 -j ACCEPT
iptables -nL (再次查看)
iptables -I INPUT 2 -p tcp -m tcp --dport 5900 -j ACCEPT