TigerVNC在Debian中展示图形界面需安装服务器、配置桌面环境并启动服务,步骤如下:
安装基础组件
sudo apt update && sudo apt upgradesudo apt install tigervnc-standalone-server tigervnc-commonsudo apt install xfce4 xfce4-goodies配置VNC密码
运行命令:vncpasswd,按提示设置密码。
定制图形界面启动脚本
编辑 ~/.vnc/xstartup 文件,添加对应桌面环境的启动命令(如Xfce):
#!/bin/sh
unset SESSION_MANAGER
exec startxfce4
赋予执行权限:chmod +x ~/.vnc/xstartup。
启动VNC服务器
指定显示编号(如 :1)和分辨率启动:
vncserver :1 -geometry 1920x1080 -depth 24。
设置开机自启动(可选)
创建systemd服务文件 /etc/systemd/system/vncserver@:1.service,内容参考,然后执行:
sudo systemctl daemon-reload && sudo systemctl enable --now vncserver@:1.service。
客户端连接
使用TigerVNC Viewer等客户端,输入服务器IP及端口号(默认 :1 对应5901端口)和密码即可访问图形界面。
注意:确保防火墙开放VNC端口(默认5900+显示编号),非root用户需正确配置用户权限。