noVNC 安装、配置与使用

最近项目中使用到了远程终端操控,从各方找到了noVNC这个神奇的家伙,废话不多说,开始介绍它的安装配置与使用。

1. 下载noNVC

好多渠道可以下载到noVNC,可以直接访问noVNC的官方网页http://kanaka.github.io/noVNC/,直接下载Zip文件解压安装。最方便的就是使用git进行安装了。

git clone git://github.com/kanaka/noVNC

然后我们切入到noVNC目录。

cd noVNC

2. 安装vncserver

首先我们来了解一下为什么要安装这个东西,官方解释如下:

tightvnc provide a nice startup script that can be used to run a separate X desktop that is served by VNC.

紧接着有如下的说明:

To install and run the server under Ubuntu you would do something like this:

sudo apt-get install tightvncserver
vncserver :1

OK,我们就照着官方给出的命令进行执行,vncserver就启动了。在这里需要注意一个事情:

The VNC server will run in the background. The port that it runs on is the display number + 5900 (i.e. 5901 in the case above).

意思就是当你执行vncserver :1设置为1时,下面要运行noVNC是的端口号应该是5900+1,那就是5901.

3. 创建安全连接

VNC的默认会话不是安全的,我们需要创建一个安全的VNC连接。来看看官方给出的介绍:

To encrypt the traffic using the WebSocket ‘wss://’ URI scheme you need to generate a certificate for the proxy to load. By default the proxy loads a certificate file name self.pem but the –cert=CERT option can override the file name. You can generate a self-signed certificate using openssl. When asked for the common name, use the hostname of the server where the proxy will be running:

那我们就参照执行给出的命令:

openssl req -new -x509 -days 365 -nodes -out self.pem -keyout self.pem

这时会发现提示需要你输入内容,这些字段我们并不需要都进行填写,我在配置过程中只填写了Common Name (e.g. server FQDN or YOUR name) []:这个字段,填写的内容是本机的hostname,一路回车完成创建,so easy.
创建完毕的证书self.pem需要放置到noVNC/utils目录下,当启动noVNC时,websockify将自动装载证书。

4. 运行noVNC

废话不多说,直接上命令

./utils/launch.sh --vnc localhost:5901

服务启动后,会显示一个链接地址,例如:

http:/localhost:6080/vnc.html?host=localhost&port=6080

将地址输入浏览器地址栏,便能看到如下页面
noVNC远程连接

Host为本机的IP,也可以填写hostname. Password为本机的登录密码. 输入后便可连接。

至此,我们就可以愉快地使用noVNC了,祝使用愉快^_^。

参考:

  • 6
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值