9 月 052013
 

……

[root@localhost ~]# virt-install –name=RHEL –description=”RHEL 6″ \
> –os-type=linux –os-variant=rhel6 \
> –hvm –ram=1024  –vcpus=1 \
> –cdrom=/usr/local/src/CentOS-6.3-i386-minimal.iso \
> –disk=/var/lib/libvirt/images/rhel.img,size=8 \
> –network bridge=br0 \
> –graphics vnc,password=12345,listen=0.0.0.0,port=5901,keymap=us

Starting install…
Creating domain…                                       |    0 B     00:00
Cannot open display:
Run ‘virt-viewer –help’ to see a full list of available command line options
Domain installation still in progress. You can reconnect to
the console to complete the installation process.
[root@localhost ~]#

查看虚拟机图形接口已经监听5901端口
[root@localhost ~]# netstat -lunt |grep 5901
tcp        0      0 0.0.0.0:5901                0.0.0.0:*                   LISTEN
[root@localhost ~]#

使用RealVNC Viewer 连接虚拟机输入密码后出现闪退的问题

kvm-vnc-install-01 kvm-vnc-install-02 kvm-vnc-install-03 kvm-vnc-install-04 kvm-vnc-install-05 kvm-vnc-install-06 kvm-vnc-install-07

9 月 052013
 

……

启动一个virt-install安装任务并使用参数确定配置

[root@localhost ~]# virt-install --name=CentOS --description="CenOS 6" \
 > --os-type=linux --os-variant=rhel6 \
 > --hvm --ram=1024  --vcpus=1 \
 > --cdrom=/var/lib/libvirt/images/CentOS-6.3-i386-minimal.iso \
 > --disk=/var/lib/libvirt/images/centos.img,size=8 \
 > --network bridge=virbr0 \
 > --graphics vnc,password=12345,port=5920,keymap=us

Starting install...
 Creating domain...                                       |    0 B     00:00
 Cannot open display:
 Run 'virt-viewer --help' to see a full list of available command line options
 Domain installation still in progress. You can reconnect to
 the console to complete the installation process.
 [root@localhost ~]#

查看图形接口的端口监听

[root@localhost ~]# netstat -lutn |grep 5920
 tcp        0      0 127.0.0.1:5920              0.0.0.0:*                   LISTEN
 [root@localhost ~]#

查看新建虚拟机实例的运行状态

[root@localhost ~]# virsh list
 Id    Name                           State
 ----------------------------------------------------
 1     CentOS                        running

[root@localhost ~]#

关于VNC的端口使用范围

VNC port must be a number between 5900 and 65535, or -1 for auto allocation