In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "how to achieve NoVNC to deliver VNC remote connection by Web". In daily operation, I believe many people have doubts about how to achieve NoVNC to deliver VNC remote connection by Web. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the question of "how to achieve NoVNC to deliver VNC remote connection by Web". Next, please follow the editor to study!
What is noVNC
NoVNC is a HTML5 VNC client, implemented with HTML5 WebSockets, Canvas and JavaScript. NoVNC is widely used in major cloud computing and virtual machine control panels, such as OpenStack Dashboard and OpenNebula Sunstone using noVNC.
NoVNC is implemented by WebSockets, but at present, most VNC servers do not support WebSockets, so noVNC cannot directly connect to VNC servers, and requires an agent to convert between WebSockets and TCP sockets. This agent is in the noVNC directory, called websockify.
* * Target: * * access the Windows desktop remotely through a browser.
* * principle: * * browsers do not support VNC, so you cannot connect to VNC directly, but you can use a proxy to establish a connection through WebSocket using noVNC, while VNC Server does not support WebSocket, so you need to enable Websockify proxy to convert between WebSocket and TCP Socket.
Second, CentOS 7 installs novnc1. Environment [root@novnc ~] # cat / etc/redhat-release CentOS Linux release 7.6.1810 (Core) [root@novnc ~] # ifconfig eth0 | awk 'NR==2 {print $2}' 10.0.0.60setenforce 0systemctl stop firewalldsystemctl disable firewalld2. Installation and configuration
Install the desktop environment
How to install a desktop environment on CentOS7
Install tigervnc
# install the dependent package wget-O / etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repocurl-o / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repoyum install-y git tigervnc-server-y
Start the VNC service and enter the password
[root@novnc] # vncserver: 1You will require a password to access your desktops.Password:Verify:Would you like to enter a view-only password (YBO)? YPassword:Verify:New 'novnc:1 (root)' desktop is novnc:1Creating default startup script / root/.vnc/xstartupCreating default config / root/.vnc/configStarting applications specified in / root/.vnc/xstartupLog file is / root/.vnc/novnc:1.log# when the execution vncserver: 1 is set to 1, the port number to run VNC is 5900, which means that the default port of 5901 is 5900. # write self-boot chmod + x / etc/rc.d/rc.localecho'/ usr/bin/vncserver: 1'> > / etc/rc.d/rc.local
View the log
Cat / root/.vnc/novnc:1.log
View Port
[root@novnc utils] # netstat-lntup | grep 59tcp 0 0 0. 0 lntup 5901 0 0 0 LISTEN 8380/Xvnc tcp6 0 0:: 5901:: * LISTEN 8380/Xvnc
Install noVNC
Git clone https://github.com/novnc/noVNC.git
Create a secure connection (enter all the way)
The default session for VNC is not secure. We need to create a secure VNC connection and we will find that we are prompted for input. We do not need to fill in all these fields. When we start noVNC, websockify will automatically load the certificate.
# to put the generated self.pem file under noVNC/utils cd. / noVNC/utils/openssl req-new-x509-days 365-nodes-out self.pem-keyout self.pem
Run noVNC
[root@novnc noVNC] # pwd/root/noVNC [root@novnc noVNC] #. / utils/launch.sh-- vnc localhost:5901
Test for access connection
Http://ip:6080/vnc.html
Set Boot self-boot
Echo'. / root/noVNC/utils/launch.sh-- vnc localhost:5901 & > > / etc/rc.d/rc.local
Install numpy to solve the slow connection speed:
Https://sourceforge.net/projects/numpy/files/
# installation of python depends on yum install python-dev python-devel-y # uploading compressed package and decompressing unzip numpy-1.11.2.zipcd numpy-1.11.2/python setup.py install3. One-click installation script [root@novnc scripts] # cat novnc_install.sh#! / bin/bash### File Name: novnc_install.sh# Version: V1. Installation Author: lcx# Organization: www.in365robot.com# # Environment optimization setenforce 0systemctl stop firewalldsystemctl disable firewalld# install vncserver & & gityum install-y epel*yum install tigervnc-server git-y # start the VNC service and enter the password echo 'Please enter the password:' vncserver: download noVNCgit clone git://github. Com/kanaka/noVNC# create a secure connection cd. / noVNC/utils/openssl req-new-x509-days 365-nodes-out self.pem-keyout self.pem# run noVNCcd.. /. / utils/launch.sh-- vnc localhost:5901 & echo 'Please visit http://ip:6080/vnc.html' # self-launch chmod + x / etc/rc.d/rc.localecho'/ usr/bin/vncserver: 1'> > / etc/rc.d/rc.localecho'. / root / noVNC/utils/launch.sh-- vnc localhost:5901 &'> / etc/rc.d/rc.local [root@novnc scripts] # chmod + x / server/scripts/novnc_install.sh [root@novnc scripts] # ll / server/scripts/novnc_install.sh-rwxr-xr-x. 1 root root 903 Dec 24 18:25 / server/scripts/novnc_ install.sh III, Windows install novnc
Achieve the goal: remotely access the Windows desktop through a browser
Prepare a 32-bit virtual machine for Windows7
1. Environment
UtralVNC:
VNC Server in Windows environment is installed on the target machine you need to access.
Note here: the production requirement is Windows7 32-bit, when downloading UtralVNC software, please download the previous older version, the latest version will not be compatible.
Node.js:
Used to execute Websockify.js. There is also a Python version of Websockify, but it won't work under Windows.
NoVNC:
NoVNC is a HTML5 VNC client
Websockify-js:
NoVNC establishes a link through websockt, but VNC server does not support websocket, so you need to open the websockify proxy to convert between WebSockets and TCP sockets.
two。 Install utralNVC server
Copy the UltraVNC software to a computer that requires remote assistance and double-click to open the installation.
Select the required components on the [Select Components] interface as needed, here on [UltraVNC Server] and [UltraVNC Viewer]. When remote assistance is needed, the installed computer must be selected on [UltraVNC Server], which is a tool for remote assistance. Click [next] to proceed to the next step of installation.
After installation, there will be shortcuts on the desktop, sky blue is a shortcut to services, and light green is a remote connection tool. At the same time, there will be a sky blue eye icon on the system tray. This is vnc server.
Right-click the small eye icon to open the menu, click [Start Service] and restart the computer.
Click [Admin Properties] to open the password for configuring the connection. The password for the connection is divided into operable password and read-only password.
3. Install Node.js
Select npm package manager
After the node.js installation is complete, you need to install ws and optimist modules (required to execute the websockify.js file)
Npm install ws
Npm install optimist
Npm install mime-types
After installing ws and optimist, the node_modules directory will be generated under C:\ Users\ Administrator\
4. Install noVNC and websockify
Extract the noVNC.zip to the node_modules directory, and then extract the websockify-master.zip to the noVNC directory.
5. Execute websockify.js
Forward the http of port 9000 to port 5900 (the default port for UltraVNC Server is 5900)
C:\ Users\ root\ node_modules\ noVNC\ websockify-js-master\ websockify > node websockify.js-- web C:\ Users\ root\ node_modules\ noVNC 9000 localhost:5900
This prompt appears when accessing http://192.168.1.163:9000/ in a browser.
You need to change filename + ='/ index.html' in websockify.js to filename + ='/ vnc.html'
Click the link to enter the password set by UltraVNC to complete.
6. Firewall New inbound Rule
If access is prohibited, access to port 9000 needs to be allowed.
7. Windows self-boot setting
Windows self-launch bat script link
# 1. Create a new desktop self-startup batch file start.bat
@ echo off
Start "cmd"cd C:\ Users\ root\ node_modules\ noVNC\ websockify-js-master\ websockify\" & node websockify.js-web C:\ Users\ root\ node_modules\ noVNC 9000 localhost:5900 "
Open and run and enter shell:startup to enter. Put the start.bat startup file in the folder
4. Visit noVNC through open Weipien
Generate the client certificate novnc01 by executing an one-click generation script on the OpenWipien server
# View private network IP information [root@open micropian-novnc ~] # ifconfig eth0 | awk 'NR==2 {print $2}' 172.17.43.16" View public network IP information [root@open micropian-novnc ~] # curl ifconfig.me182.92.226.114 [root@open micropian-novnc ~] # git clone https://github.com/Nyr/open micropian-install.git [root@open micropian-novnc ~] # ls open micropion-install/LICENSE. Txt open-install.sh README.md [root@open-novnc open-install] # cd open-install/ & & bash open-install.sh # installation steps please see the previous documentation One click to generate client certificate [10:54 root@openvpn-novnc ~ / openvpn-install] # bash openvpn-install.sh Looks like OpenVPN is already installed.What do you want to do? 1) Add a new user 2) Revoke an existing user 3) Remove OpenVPN 4) ExitSelect an option: 1Tell me a name for the client certificate.Client name: novncUsing SSL: openssl OpenSSL 1.0.2k-fips 26 Jan 2017Generating a 2048 bit RSA private key. . +. + writing new private key to'/ etc/openvpn/server/easy-rsa/pki/private/novnc.key.XHM8ERJnnn'-Using Configuration from. / safessl-easyrsa.cnfCheck that the request matches the signatureSignature okThe Subject's Distinguished Name is as followscommonName: ASN.1 12:'novnc01'Certificate is to be certified until Dec 27 02:56:23 2029 GMT (3650 days) Write out database with 1 new entriesData Base UpdatedClient novnc01 added Configuration is available at: / root/novnc.ovpn
Upload the generated certificate to the PC client with novnc installed
Download windows7 version of the client software openvpn-gui
Https://www.techspot.com/downloads/5182-openvpn.html
Make a connection
A certificate is also generated on another PC client for connection access
If openvpn is disconnected, the connection of novnc will be disconnected.
At this point, the study on "how to implement NoVNC to deliver VNC remote connections by Web" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.