KVM虚拟化:使用VNC访问客户机VM
2016-02-12 19:27
351 查看
简介
如果你想通过VNC访问客户机VM的窗口,你需要将客户机窗口添加到VNC服务器中。本文介绍如何通过修改xml配置文件来设置VNC参数,并通过VNC client来访问VM的VGA窗口。修改配置文件
KVM客户机的配置文件放置在/etc/libvirt/qemu目录下。使用vi可以查看虚拟机的xml配置文件。[root@CentOS65 ~]# vi /etc/libvirt/qemu/centos65.xml <!-- WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE OVERWRITTEN AND LOST. Changes to this xml configuration should be made using: virsh edit centos65 or other application using the libvirt API. --> <domain type='kvm'> <name>centos65</name> <uuid>9a1e6c72-47df-f5a5-a5b5-71311472248a</uuid> <memory unit='KiB'>2097152</memory> <currentMemory unit='KiB'>2097152</currentMemory> <vcpu placement='static'>1</vcpu> <os> <type arch='x86_64' machine='rhel6.6.0'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> ...... <graphics type='vnc' port='5920' autoport='no'/> ... </devices> </domain>xml文件的devices元素包含对虚拟机的设备配置,通过配置其中的graphics元素,可以设置VNC连接。graphics元素包含以下可以配置属性:
type属性: 此属性为必须配置的属性,可以设置为"sdl", "vnc", "rdp" or "desktop". 在上面的例子中,设置为vnc,以可通过VNC进行远程访问。
port属性:VNC服务端口号,是属性在autoport属性值设置为"no"时有效
autoport属性: 是否自动分配VNC TCP端口,配置为"yes"或"no"。与port属性配合使用。
passwd属性: 以明文方式设置VNC登录密码
keymap属性: 键盘配置
listen属性: VNC服务侦听的IP地址.
可以通过virsh命令查看当前VNC端口配置信息
[root@CentOS65 ~]# virsh vncdisplay error: command 'vncdisplay' requires <domain> option [root@CentOS65 ~]# virsh vncdisplay centos65 127.0.0.1:20配置完成后,重启相关服务:
# service libvirtd restart # virsh shutdown centos65 # virsh start centos65
相关文章推荐
- 观察者模式
- HDU 1829
- 社会杂谈
- [算法]最长的可整合数组的长度
- Qt下载地址
- 第九章
- java基础15集合List
- poj3723 Conscription Kruscal算法最大生成森林
- 《满族姓氏寻根大全·满族老姓全录》
- 将印象笔记的内容转至onenote
- mycat高可用 ER分片的2种场景详细分析
- HDU1561 The more, The Better(树形DP)
- c++ 输入输出
- VS2013的CListCtrl练习
- HDU5183 哈希表
- String ,StringBuilder, StringBuffer
- sublime快捷键
- Ubuntu下设置自定义桌面分辨率
- Android:支持多选的本地相册
- 【shiro】shiro学习笔记1 - 初识shiro