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.
Installation
You're ready now. Please follow steps below:
Update software cache and install packages via system package management tool:
Run the installed tool and set access password. You can also set separated password for "viewers" if you want:
Kill the session:
Add one row to the settings file:
Add execution permissions to file:
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:
[Unit]
Description=VNC-server
After=syslog.target network.target
[Service]
Type=forking
User=root
PAMName=login
PIDFile=/root/.vnc/%H:1.pid
ExecStartPre=-/usr/bin/vncserver -kill :1 > /dev/null 2>&1
ExecStart=/usr/bin/vncserver
ExecStop=/usr/bin/vncserver -kill :1
[Install]
WantedBy=multi-user.target
EOT
Enable our service and launch it:
systemctl start vnc
Conclusion
Now you may organize an easy access to the your server's desktop environment and set this access permanently working.