This is an old revision of the document!
sudo apt install tightvncserver
sudo ufw allow VNC sudo ufw allow 5902/tcp
sudo vim /etc/systemd/system/vncserver@.service
[Unit] Description=Start TightVNC server at startup After=syslog.target network.target [Service] Type=forking User=<user> Group=<user> WorkingDirectory=/home/<user> PIDFile=/home/<user>/.vnc/%H:%i.pid ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1 ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 -dpi 96 :%i ExecStop=/usr/bin/vncserver -kill :%i [Install] WantedBy=multi-user.target
The ExecStartPre command stops VNC if it’s already running, make sure the command is preceded by a “-”. The ExecStart command starts VNC and sets the color depth to 24-bit color with a resolution of 1920×1080 and dpi to 96 which ensures the fonts are large enough.
sudo systemctl daemon-reload
sudo systemctl enable vncserver@2.service
The 2 following the @ sign signifies which display number the service should appear over, in this case the default :2.
vncserver -kill :2
/tmp/.X2-lock /tmp/.X11-unix/X2
sudo systemctl start vncserver@2
Your VNC server will now be available when you reboot the machine.