这个VNC可真是搞了有一段时间了,从一开始有问题到后来远程连上本地就会断开断断续续碰到各种问题,直到那天看到一篇x11vnc的教程,终于搞成功了。。。
留作记录。
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
1 安装 X11VNC
sudo apt install x11vnc
2 配置访问密码
sudo x11vnc -storepasswd /etc/x11vnc.pass
3 创建systemctl服务
sudo vim /lib/systemd/system/x11vnc.service
[Unit]
Description=Start x11vnc at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared
[Install]
WantedBy=multi-user.target
4 配置防火墙,配置和启动服务
sudo ufw allow 5900 #默认端口5900
sudo systemctl enable x11vnc.service #开启x11vnc服务
sudo systemctl daemon-reload
sudo systemctl restart x11vnc.service #重启x11vnc服务
5 启动x11vnc server
sudo service x11vnc start #设置分辨率为1920*1080
6 修改分辨率
如果机器上没有连接显示器的话,那么大概率重启以后只有一个800*600的小窗口,我们可以通过下面两种方式修改:
6.1 x11配置文件
sudo vim /etc/X11/xorg.conf #创建配置文件
文件内容:(注意缩进)
Section "Device"
Identifier "Configured Video Device"
EndSection
Section "Monitor"
Identifier "Configured Monitor"
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
SubSection "Display"
Depth 24
Virtual 1920 1080
EndSubSection
EndSection
将内容中的1920 1080修改为你需要的分辨率,配置完成后重启
6.2 使用xrandr命令
xrandr --fb 1280x1024 #1280x1024为分辨率
本文档详细记录了在Ubuntu 18.04上安装和配置X11VNC服务的步骤,包括安装软件、设置密码、创建systemd服务、配置防火墙、启动服务以及解决分辨率问题的方法,适用于需要远程桌面访问的用户。
2354

被折叠的 条评论
为什么被折叠?



