在 Ubuntu 上搭建和使用 VNC(Virtual Network Computing),通常需要以下几类依赖和组件,具体取决于你使用的桌面环境和 VNC 服务端。
sudo apt update
sudo apt install -y xauth
xauth:X11 认证所需,VNC 会话通常依赖 X。VNC 本身不提供桌面,只负责显示,所以需要桌面环境:
sudo apt install -y xfce4 xfce4-goodies
sudo apt install -y ubuntu-desktop
gnome-sessionmate-desktoplxqt常用 VNC Server:
sudo apt install -y tigervnc-standalone-server tigervnc-common
sudo apt install -y tightvncserver
.debVNC 依赖 X Server:
sudo apt install -y xorg
部分环境会自动安装。
sudo apt install -y dbus-x11
sudo apt install -y fonts-noto-cjk # 中文支持
用户首次运行:
vncserver
会生成:
~/.vnc/xstartup~/.vnc/passwd#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
使用 systemd 管理 VNC:
systemd/etc/systemd/system/vncserver@.servicesudo ufw allow 5901
sudo apt install -y xfce4 tigervnc-standalone-server xauth
如果你愿意,我可以: