What is VNC
VNC (Virtual Network Computing) - software which made your "local" keyboard and mouse as connected to the any other server. This tool provides the easy management of files, software and settings on a remote server.
Requirements to install
Although VNC-console as CLI-mode management tool is possible, it is completely senseless cause SSH is better in this scenario (except disaster-recovery). So, reason to use VNC is GUI presence. You need at least 2Gb RAM, 2 cores CPU and 20-30 GB of drive space.
You're ready now. Please follow steps below:
Update software cache and install packages via system package management tool:
apt-get update && apt install xfce4-goodies tightvncserver xfce4
Run the installed tool and set access password. You can also set separated password for "viewers" if you want:
Kill the session:
vncserver -kill :1
Add one row to the settings file:
echo "startxfce4 &" >> /root/.vnc/xstartup
Add execution permissions to file:
chmod -rwxr-xr-x /root/.vnc/xstartup
Run the service again:
Now your VNC-service is ready to use. Remember: if you prefere any VNC-client you need to add "59" before "real" port number. E.g. if real port is "1", you must use "5901" in your client software instead:
Result like below should appear. If you've seen this - you're great!
Next step is optional: you may want ro run VNC service automatically. It is easy peasy. Create a service initial file:
cat <<EOT >> /etc/systemd/system/vnc.service
ExecStartPre=-/usr/bin/vncserver -kill :1 > /dev/null 2>&1
ExecStop=/usr/bin/vncserver -kill :1
Enable our service and launch it:
systemctl enable vnc
systemctl start vnc
Now you may organize an easy access to the your server's desktop environment and set this access permanently working.