本文基于 Ubuntu 20.04 编写。
- 安装 vncserver 和要使用的桌面管理器 xfce
1apt install tightvncserver xfce4 xfce4-goodies
- 更改密码
1vncpasswd
- 配置 vnc 以便客户端连接时使用 xfce 桌面
编辑 ~/.vnc/xstartup,输入以下内容
1#!/bin/sh 2unset SESSION_MANAGER 3unset DBUS_SESSION_BUS_ADDRESS 4startxfce4 &
- 执行以下命令
1chmod +x ~/.vnc/xstartup
- 禁用休眠
1systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
- 启动服务器
1vncserver -localhost no -geometry 1920x1080
参考
https://linuxconfig.org/vnc-server-on-ubuntu-20-04-focal-fossa-linux