Ubuntu 24.04 使用 RealVNC Service Mode + GNOME + Windows VNC Viewer 配置记录 0.0 下载安装包VNC-Server-6.11.0-Linux-x64.deb通过网盘分享的文件VNC-Server-6.11.0-Linux-x64.deb链接: https://pan.baidu.com/s/1NuQr3SwnYIJfL9-he7_waw 提取码: b7waVNC-Viewer-7.0.1-Windows.exe通过网盘分享的文件VNC-Viewer-7.0.1-Windows.exe链接: https://pan.baidu.com/s/1pmUqv0yux1TpMoPn1GJDQQ 提取码: 9ht41.0 安装 RealVNC 6.11.0安装命令sudo dpkg -i VNC-Server-6.11.0-Linux-x64.deb激活命令sudo vnclicense -add 3TH6P-DV5AE-BLHY6-PNENS-B3AQA或者sudo vnclicense -add URF4A-YZRVW-PEDAE-BLNK3-Y5DMA2.0 配置RealVNC Service Mode GNOME注意这里是Service Mode不是Virtual Mode2.1 启动 RealVNC Service Modesudo systemctl enable vncserver-x11-serviced sudo systemctl start vncserver-x11-serviced检查是否启动systemctl status vncserver-x11-serviced正常显示为Active: active (running)继续检查ps -ef | grep vnc正常显示为/usr/bin/vncserver-x11-serviced /usr/bin/vncserver-x11-core -service /usr/bin/vncagent service 0不要出现Xvnc-core :12.2 解决 GNOME 崩溃问题Service Mode启动后出现A problem has occurred and the system cant recover 等可能原因是Ubuntu 24.04 默认 Wayland而RealVNC Service Mode 不适合 Wayland。这时候进行如下修改sudo vim /etc/gdm3/custom.conf设置[daemon] WaylandEnablefalse2.3 设置GNOME自动登录因为服务器远程控制一般无人值守需要自动进入桌面。这时需要打开custom.confsudo vim /etc/gdm3/custom.conf修改为[daemon] WaylandEnablefalse AutomaticLoginEnabletrue AutomaticLoginlee重启电脑sudo reboot进行检查loginctl list-sessions正常结果seat0 tty2 active继续检查ps -ef | grep gnome-shell正常结果xxxx /usr/bin/gnome-shell3.0 Service Mode 下 vncviewer 黑屏无任何提示的问题解决如果发现 GNOME正常、Xorg正常、VNC server 正常但VNCviwer仍然黑屏。进行如下检查sudo -u lee DISPLAY:0 xrandr如果发现Screen 0: current 640x480 HDMI-0 disconnected DP-0 disconnected ...说明服务器没有HDMI显示器 和 DP显示器 等。Xorg没有有效输出。这时可以安装安装 Dummy Displaysudo apt install xserver-xorg-video-dummy -y创建sudo vim /etc/X11/xorg.conf内容如下Section Device Identifier DummyGPU Driver dummy VideoRam 256000 EndSection Section Monitor Identifier DummyMonitor HorizSync 30-80 VertRefresh 60 EndSection Section Screen Identifier DummyScreen Device DummyGPU Monitor DummyMonitor DefaultDepth 24 SubSection Display Depth 24 Modes 1920x1080 EndSubSection EndSection这时候可以再次重启电脑啦sudo reboot