本文基於 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