noNVC基础用法:

1、下载noVNC

git clone https://github.com/novnc/noVNC.git

2、编辑qemu.conf配置文件

  Vim /etc/libvirt/qemu.conf

  将配置文件中的vnc_listen = "0.0.0.0" 启用

3、查看虚拟机vnc端口

  Virsh vncdisplay vm001

  :0      // 表示5900

  也可以在创建虚拟机xml文件是指定vm的vnc端口

<graphics type='vnc' port='' autoport='no' listen='0.0.0.0'>
<listen type='address' address='0.0.0.0'/>
</graphics>

4、启动noVNC

  .noVNC/utils/launch.sh --vnc host_ip:5910

noVNC高级用法:

在基础用法用需要为每启用一个代理,在实际应用中不可能为每台虚拟机都架一个代理,这种方式对端口号的消耗也是巨大的。

因此我们需要做的是使用一个端口来使用多个代理,因此需要引入Token的概念。

这里需要用的是websockify,在 Github 上 noVNC 和 websockify 本来就是独立的两个项目。

在我们第一次运行./noVNC/utils/launch.sh时会自动下载websockify

目录结构:

1、创建token文件

  在websockify目录中创建目录token,并在该目录下创建token文件,写入以下内容:

token:  host_ip:port

  这里需要注意的坑是token:后面是有一个空格的(少了这个空格让我调试了一个夜晚)。

2、启动websockify

  进入websockify目录 --web ../ 是为了使用noVNC的vnc.html和vnc_lite.html文件

./run --web ../ --target-config ./token/token localhost:8888

3、浏览器测试

 http://localhost:8888/vnc_lite.html?path=?token=vm004  (这里我直接使用的是虚拟机vm004的名称来作为Token,只需要修改Token就能够访问相应的虚拟机)

扩展Token类型

Custom plugins should match the format of the BasePlugin class found in websockify/token_plugins.py. Namely, they should implement an __init__(self, src) method (where src is the value of --token-source), and a lookup(self, token) method which either returns a (host, port) tuple, or None.

The plugin can be placed in any module that's importable by websockify, and then be used as such:

$ ./run ... --token-plugin some.module.TokenClass --token-source 'some information here'

Example:

import memcache
import simplejson class TokenMemc(object):
def __init__(self, src):
self._server = src def lookup(self, token):
client = memcache.Client([self._server], debug=0)
stuff = client.get(token)
combo = simplejson.loads(stuff)
pair = combo["host"]
return pair.split(':')

noVNC的更多相关文章

  1. webvnc利器-noVNC集成实战

    我们在做一个虚拟机管理平台,底层虚拟化使用KVM,我们希望在网页上操作虚拟机. 一开始用applet嵌在网页内实现webvnc,不过由于applet的在浏览器上运行安全性限制,我们需要一个新的方案.此 ...

  2. noVNC支持手机自带键盘输入

    代码修改说明 novnc的web链接类似为:http://192.168.1.177:6080/vnc_auto.html?token=105356fa-bbe3-43e4-a0ce-7703dc42 ...

  3. CentOS安装noVNC,以Web方式交付VNC远程连接

    什么是noVNC noVNC 是一个 HTML5 VNC 客户端,采用 HTML 5 WebSockets, Canvas 和 JavaScript 实现,noVNC 被普遍用在各大云计算.虚拟机控制 ...

  4. 配置Nginx反向代理WebSocket,以代理noVNC为例

    什么是Nginx Nginx (engine x) 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器. Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮 ...

  5. novnc安装教程

    适配于centos7 1.安装vncserver # stop selinux and iptables setenforce systemctl stop firewalld systemctl d ...

  6. noVNC连接CentOS,以Web方式交付VNC远程连接

    什么是noVNC? noVNC 是一个 HTML5 VNC 客户端,采用 HTML 5 WebSockets, Canvas 和 JavaScript 实现,noVNC 被普遍用在各大云计算.虚拟机控 ...

  7. Centos 6.X noVNC+websockify 实现webvnc

    文章参考:https://github.com/kanaka/noVNC http://www.cnblogs.com/yanghuahui/p/3574388.html 工作原理: noVNC 可以 ...

  8. noVNC 搭建

    安装VNCSERVER 在使用noVNC之前,必须得先装vncserver,方法如下: yum -y install vnc-server 安装完成后,执行vncserver配置密码 命令:vncse ...

  9. noVNC使用——访问多台vnc

    一.模拟实验环境 1.CentOS6.8系统2.KVM环境3.使用KVM环境的两个系统(Windows,Linux)4.noVNC5.vncserver 二.实验过程1.在kvm的环境下,通过xml创 ...

随机推荐

  1. 摘录 LDAP

    1.LDAP就是 light DAP, 轻量级目录访问协议     LDAP是轻量目录访问协议(Lightweight Directory Access Protocol)的缩写     LDAP标准 ...

  2. linux sublime python

    (三)配置python3编译环境 1.点击上部菜单栏Tools->Build System ->new Build System 2.点击之后,会出现一个空的配置文件,此时,往这个空配置文 ...

  3. Problem A. Dynamic Grid

    Problem We have a grid with R rows and C columns in which every entry is either 0 or 1. We are going ...

  4. C语言基础知识【程序结构】

    C 程序结构1.C 程序主要包括以下部分:预处理器指令函数变量语句 & 表达式注释2.#include <stdio.h> int main(){   /* 我的第一个 C 程序 ...

  5. 7月份计划-----dream

    梦想还是要有的,万一实现了呢? 数学 150[total] 专业课 150[total] 英语 100[total] 政治 100[total] 第一轮复习计划开始执行 1.专业课: 通过课件把所有的 ...

  6. hihoCoder#1037 : 数字三角形(DP)

    [题目链接]:click here~~ 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 问题描写叙述 小Hi和小Ho在经历了螃蟹先生的任务之后被奖励了一次出国旅游的机会,于是他 ...

  7. python 上传文件下载图片

    python 2.7 poster-0.8.1 requests-2.7.0 #coding:utf-8import urllibimport urllib2import sysimport time ...

  8. Unity3d NGUI 360度旋转

    [AddComponentMenu("NGUI/Examples/Spin With Mouse")] publicclass SpinWithMouse : MonoBehavi ...

  9. RMQ with Shifts(线段树)

    RMQ with Shifts Time Limit:1000MS     Memory Limit:65535KB     64bit IO Format:%I64d & %I64u Pra ...

  10. debian安装oracle jdk

    1 去官网下载linux jdk https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.htm ...