1.安装kvm
grep -E -o ‘vmx|svm‘ /proc/cpuinfo #检查服务器是否支持虚拟化(vmx为interl平台、svm是AMD平台) #安装KVM所需软件包: yum groupinstall kvm 或 yum install kvm kmod-kvm qemu kvm-qemu-img virt-viewer virt-manager libvirt libvirt-python python-virtinst bridge-utils lsmod |grep kvm #检查是否安装成功
2.安装vnc
rpm -qa | grep vnc-server #检查系统是否安装vncserver yum install tigervnc-server fontforge -y #安装tigervnc-server和字体编译器(防止远程出现乱码) yum groupinstall Desktop -y #安装桌面环境 vncpasswd #配置vncserver 密码 ,有时不配服务器起不来 vi ./vnc/xstartup #改成自己安装的桌面环境,twm & 注释掉 # twm & gnome-session & vi /etc/sysconfig/vncserver #更改默认登陆用户和远程分辨率 VNCSERVERS="1:root" VNCSERVERARGS[2]="-geometry 1024X768 -nolisten tcp -localhost" 注: 1.关闭selinux 2.iptables 放行5901端口
3.配置桥口(主要用于KVM虚拟机中安装虚拟机,可以和真是机互通并可出外网)
brctl addbr br0 #添加网桥br0 brctl addif br0 eth0 #添加eth0 到br0中 brctl addif br0 eth1 #添加eth1 到br0中 cp /etc/sysconfig/network-script/ifcfg-eth0 /etc/sysconfig/network-script/ifcfg-br0 #创建桥口br0 vi /etc/sysconfig/network-script/ifcfg-br0 vi /etc/sysconfig/network-script/ifcfg-eth0 vi /etc/sysconfig/network-script/ifcfg-eth1 DEVICE="br0" BOOTPROTO="static" #HWADDR="………………" #前面加井号注释掉mac地址,因为是eth0上拷贝的 ONBOOT="yes" TYPE="Bridge" IPADDR=115.236.81.249 NETMASK=255.255.255.240 GATEWAY=115.236.81.241 vi /etc/sysconfig/network-script/ifcfg-eth0 DEVICE="eth0" BOOTPROTO="static" HWADDR="………………" #默认 ONBOOT="yes" TYPE="Ethernet" IPADDR=X.X.X.X NETMASK=X.X.X.X GATEWAY=X.X.X.X BRIDGE="br0" vi /etc/sysconfig/network-script/ifcfg-eth1 DEVICE="eth1 BOOTPROTO="static" HWADDR="………………" #默认 ONBOOT="yes" TYPE="Ethernet" IPADDR=X.X.X.X NETMASK=X.X.X.X BRIDGE="br0" 关闭NetworkManager service network restart
KVM+SVN 虚拟机远程管理,布布扣,bubuko.com
原文:http://www.cnblogs.com/cpy-devops/p/3881053.html