noVNC的安装使用

noVNC官网:https://novnc.com/info.html

noVNC Github:https://github.com/novnc/noVNC

websockify Github:https://github.com/novnc/websockify

说明:

VNC server:192.168.253.135

noVNC :192.168.253.135

vnc server port :5908

noVNC port: 6080

下载软件包:

下载慢和下载失败,直接手动用浏览器下载,再上传服务器。

wget -O noVNC-1.4.0.tar.gz https://github.com/novnc/noVNC/archive/refs/tags/v1.4.0.tar.gz
wget -O websockify-0.11.0.tar.gz https://github.com/novnc/websockify/archive/refs/tags/v0.11.0.tar.gz

解压软件包

tar -zxvf noVNC-1.4.0.tar.gz
tar -zxvf websockify-0.11.0.tar.gz -C noVNC-1.4.0/utils

启动vnc端口

在需要代理的vnc服务端启动vnc服务,或者是有现成的可连接的vncserver可忽略这一步

# 如果没安装vnc先安装vnc
vncserver :8

使用noVNC

sudo firewall-cmd --zone=public --add-port=6080/tcp --permanent
sudo firewall-cmd --reload
sudo firewall-cmd --zone=public --list-port
# start 
# ./noVNC-1.4.0/utils/novnc_proxy --vnc localhost:5908
# ./noVNC-1.4.0/utils/novnc_proxy --vnc 192.168.253.135:5908 --listen 6080
./noVNC-1.4.0/utils/novnc_proxy --vnc 192.168.253.135:5908 --listen 192.168.253.135:6080

在局域网使用浏览器访问:http://192.168.253.135:8080/vnc.html

其他用法

使用证书

cd noVNC-1.4.0/utils/
sudo yum install openssl -y
openssl req -new -x509 -days 365 -nodes -out self.pem -keyout self.pem # 按需填写
./noVNC-1.4.0/utils/novnc_proxy --vnc 192.168.253.135:5908 --listen 192.168.253.135:6080

在局域网使用浏览器访问:https://192.168.253.135:8080/vnc.html

安装numpy

sudo apt install python3-pip
# 临时替换清华源
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
pip install numpy

# 永久替换pip国内源
# python -m pip install --upgrade pip
# pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# 如果默认pip升级速度比较慢,使用清华镜像站零时升级
# python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip

使用numpy依赖,提升速度。

$ ./noVNC-1.4.0/utils/novnc_proxy --vnc localhost:5908 --listen 192.168.253.135:6080
Using local websockify at /home/fedora/noVNC-1.4.0/utils/websockify/run
Starting webserver and WebSockets proxy on port 192.168.253.135:6080
WebSocket server settings:
  - Listen on 192.168.253.135:6080
  - Web server. Web root: /home/fedora/noVNC-1.4.0
  - SSL/TLS support
  - proxying from 192.168.253.135:6080 to localhost:5908


Navigate to this URL:

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

Press Ctrl-C to exit

再次启动就没有了警告信息:

$ ./noVNC-1.4.0/utils/novnc_proxy --vnc localhost:5908 --listen 192.168.253.135:8080
Using local websockify at /home/fedora/noVNC-1.4.0/utils/websockify/run
Starting webserver and WebSockets proxy on port 192.168.253.135:8080
WebSocket server settings:
  - Listen on 192.168.253.135:8080
  - Web server. Web root: /home/fedora/noVNC-1.4.0
  - SSL/TLS support
  - proxying from 192.168.253.135:8080 to localhost:5908


Navigate to this URL:

    http://fedora:192.168.253.135:8080/vnc.html?host=fedora&port=192.168.253.135:8080

Press Ctrl-C to exit

使用其他方式

$ cat  ./noVNC-1.4.0/token.conf
vnc1: 192.168.253.135:5908
/home/fedora/noVNC-1.4.0/utils/websockify/run --web=/home/fedora/noVNC-1.4.0 --target-config=/home/fedora/noVNC-1.4.0/token.conf --cert=/home/fedora/noVNC-1.4.0/utils/self.pem 6080
# 使用token访问:https://192.168.253.135:6080/vnc.html?path=websockify?token=vnc1

/home/fedora/noVNC-1.4.0/utils/websockify/run --web=/home/fedora/noVNC-1.4.0 --cert=/home/fedora/noVNC-1.4.0/utils/self.pem 6080 192.168.253.135:5908
# 直接使用连接可访问:https://192.168.253.135:6080/vnc.html

相关文章

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注