CLO-为云服务器配置vnc远程桌面

这篇具有很好参考价值的文章主要介绍了CLO-为云服务器配置vnc远程桌面。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

        本文共分五个部分,分别是配置云服务器安全组放开所有端口、为云服务器安装虚拟桌面、为云服务器安装vnc_server、为本地电脑安装vnc_client、分析vnc交互报文。

        首先更新系统

sudo apt update
sudo apt upgrade

一、配置云服务器安全组放开所有端口

【腾讯云】登录官网->【控制台】->【我的资源】->【云服务器】->【网络与安全】->【安全组】

starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

 【安全组】->【修改云服务器绑定的规则】 

starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

【添加规则】

starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

【添加入站规则】

类型:自定义

来源:0.0.0.0/0,表示所有IPv4源地址

协议端口:ALL,表示所有端口

策略:允许

starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

【完成】

starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

 二、为云服务器安装虚拟桌面

         安装轻量级桌面环境Xfce

         安装Xfce过程中会提示配置“lightdm”,选择“gdm3”即可

sudo apt install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils

 三、为云服务器安装vnc_server

         本次选择“TigerVNC”作为vnc_server

sudo apt install tigervnc-standalone-server tigervnc-common

        安装TigerVNC完成,配置vnc访问密码,注意最下方选择n,选择y则vnc_client拨入后仅能观看,无法操作。

ubuntu@VM-0-8-ubuntu:/etc$ vncpasswd
Password:
Verify:
Would you like to enter a view-only password (y/n)? n

        配置TigerVNC(远程软件)关联Xfce(桌面环境)

#首先find找到.vnc的路径
root@VM-0-8-ubuntu:~# find / -name .vnc
/root/.vnc
/home/ubuntu/.vnc
root@VM-0-8-ubuntu:~# 

#其次切换工作目录
root@VM-0-8-ubuntu:/# cd /root/.vnc/

#之后touch新建一个文件,文件名xstartup
root@VM-0-8-ubuntu:~/.vnc# touch xstartup

#修改新建的xstartup
root@VM-0-8-ubuntu:~/.vnc# vim xstartup 

#增加以下内容,保存并关闭文件。这样每次启动TigerVNC_server时,以下命令均会自动执行。
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec startxfce4

#给xstartup授权
root@VM-0-8-ubuntu:~/.vnc# chmod 777 xstartup
root@VM-0-8-ubuntu:~/.vnc# ls -l
-rw-r--r-- 1 root root 1782 Oct 15 22:41 localhost.localdomain:1.log
-rw-r--r-- 1 root root    7 Oct 15 22:41 localhost.localdomain:1.pid
-rw-r--r-- 1 root root 1091 Oct 15 22:44 localhost.localdomain:2.log
-rw-r--r-- 1 root root    7 Oct 15 22:44 localhost.localdomain:2.pid
-rw-r--r-- 1 root root 1117 Oct 15 22:48 localhost.localdomain:3.log
-rw-r--r-- 1 root root    7 Oct 15 22:48 localhost.localdomain:3.pid
-rw------- 1 root root    8 Oct 15 22:33 passwd
-rwxrwxrwx 1 root root   79 Oct 15 23:02 xstartup

        启动TigerVNC_server

        注意下方的localhost.localdomain:2,则vnc_client连接此vnc_server时候,所用端口号为5900+2=5902,即vnc_sever启动时候加载的是端口号x,则vnc_client连接该vnc_server时所有端口号就是5900+x。

root@VM-0-8-ubuntu:~/.vnc# vncserver
New 'localhost.localdomain:2 (root)' desktop at :2 on machine localhost.localdomain
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:2.log
Use xtigervncviewer -SecurityTypes VncAuth -passwd /root/.vnc/passwd :2 to connect to the VNC server.
root@VM-0-8-ubuntu:~/.vnc# 

#配置某些参数的启动
#-geometry 1920x1080,设定远程桌面分辨率
root@VM-0-8-ubuntu:~/.vnc# vncserver -localhost no -geometry 1920x1080 -depth 24
New 'localhost.localdomain:1 (root)' desktop at :1 on machine localhost.localdomain
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:1.log
Use xtigervncviewer -SecurityTypes VncAuth,TLSVnc -passwd /root/.vnc/passwd localhost.localdomain:1 to connect to the VNC server.

        常用TigerVNC_server命令

#查看当前存在几个vnc_server进程及各占用哪个端口号
root@VM-0-8-ubuntu:~/.vnc# vncserver -list
TigerVNC server sessions:
X DISPLAY #     RFB PORT #      PROCESS ID
:1              5901            158188
:2              5902            166676
:5              5905            157490

#杀掉vnc_server进程
root@VM-0-8-ubuntu:~/.vnc# vncserver -kill :2
Killing Xtigervnc process ID 166676... success!
root@VM-0-8-ubuntu:~/.vnc# vncserver -kill :5
Killing Xtigervnc process ID 157490... success!

#查看当前存在几个vnc_server进程及各占用哪个端口号
root@VM-0-8-ubuntu:~/.vnc# vncserver -list
TigerVNC server sessions:
X DISPLAY #     RFB PORT #      PROCESS ID
:1              5901            158188
root@VM-0-8-ubuntu:~/.vnc# 

        执行vncserver报错

#报错
root@VM-0-8-ubuntu:/# vncserver
/usr/bin/xauth:  file /root/.Xauthority does not exist
New 'localhost.localdomain:1 (root)' desktop at :1 on machine localhost.localdomain
Starting applications specified in /etc/X11/Xvnc-session
Log file is /root/.vnc/localhost.localdomain:1.log
Use xtigervncviewer -SecurityTypes VncAuth -passwd /root/.vnc/passwd :1 to connect to the VNC server.
vncserver: Failed command '/etc/X11/Xvnc-session': 256!
=================== tail -15 /root/.vnc/localhost.localdomain:1.log ===================
Copyright (C) 1999-2019 TigerVNC Team and many others (see README.rst)
See https://www.tigervnc.org for information on TigerVNC.
Underlying X server release 12008000, The X.Org Foundation
Sat Oct 15 22:33:59 2022
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on local interface(s), port 5901
 vncext:      created VNC server for screen 0
X connection to :1 broken (explicit kill or server shutdown).
Sat Oct 15 22:34:00 2022
 ComparingUpdateTracker: 0 pixels in / 0 pixels out
 ComparingUpdateTracker: (1:-nan ratio)
Killing Xtigervnc process ID 152341... which seems to be deadlocked. Using SIGKILL!
=======================================================================================
Starting applications specified in /etc/X11/Xvnc-session has failed.
Maybe try something simple first, e.g.,
        tigervncserver -xstartup /usr/bin/xterm
root@VM-0-8-ubuntu:/# 

#执行tigervncserver -xstartup /usr/bin/xterm
New 'localhost.localdomain:1 (root)' desktop at :1 on machine localhost.localdomain
Starting applications specified in /usr/bin/xterm
Log file is /root/.vnc/localhost.localdomain:1.log
Use xtigervncviewer -SecurityTypes VncAuth -passwd /root/.vnc/passwd :1 to connect to the VNC server.

四、为本地电脑安装vnc_client

TightVNC: VNC-Compatible Free Remote Control / Remote Desktop Software

【Download Now!】->【根据本地电脑操作系统选择下载版本】

starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

 starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

【下载完成】

starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

【双击安装】->【安装过程中会提示输入密码】

starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

 【安装完成】->【在本地电脑桌面看不到】->【在开始菜单/搜索可以找到】->【右键打开】

starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

【键入远程vnc_server的IP和端口号】->【注意格式remoteIP::port】->【connect】

starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

【键入vnc_server密码】->【OK】

starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

 【远程桌面登录成功】starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

五、分析vnc交互报文

 【键入远程vnc_server的IP和端口号】->【注意格式remoteIP::port】->【connect】starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

【键入vnc_server密码】->【OK】

starting applications specified in /etc/x11/xvnc-session has failed.,CLO,云计算

六、感谢

https://wiki.archlinux.org/title/TigerVNC_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
https://blog.csdn.net/level_code/article/details/125534100
https://www.51cto.com/article/635182.html
https://xie.infoq.cn/article/cf473dc0dea917b0b2a546ecd
https://www.cnblogs.com/liyuanhong/articles/15487147.html
https://blog.csdn.net/shuirenbushijun/article/details/107765654文章来源地址https://www.toymoban.com/news/detail-713170.html

到了这里,关于CLO-为云服务器配置vnc远程桌面的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包