sudo apt-get update
sudo apt install lightdm
安装完成后会出现下图
ubuntu 18.04/20.04 默认使用gdm3,导致VNC工作异常,需要切换到 lightdm
sudo dpkg-reconfigure gdm3
sudo apt install xserver-xorg-video-dummy
sudo apt-get install x11vnc
sudo apt-get install net-tools
sudo x11vnc -storepasswd /etc/x11vnc.pass
sudo chmod 755 /etc/x11vnc.pass
sudo x11vnc -auth guess -rfbauth /etc/x11vnc.pass -rfbport 5901 -forever -display :0