In this article, I will show you step by step how to install VNC on your Linux Debian Desktop or Server so you can remotely access it within your network.  

Step 1. SSH into your Debian PC  or if you have full featured Debian installed, open console on your desktop.

Step 2. Update and upgrade your system with new packages...

sudo apt update && sudo apt full-upgrade -y

Step 3. Once your system has been updated, install light desktop manager (lightdm)...

sudo apt install lightdm

Step 4. Reboot your system

sudo reboot

Step 5. Install x11VNC

sudo apt install x11vnc

Step 6. Create x11vnc.service file and Copy and paste these commands...make sure to change the password.

sudo nano /lib/systemd/system/x11vnc.service

Copy/Paste following commands in x11vnc.service file...

[Unit]
Description=x11vnc service
After=display-manager.service network.target syslog.target

[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -forever -display :0 -auth guess -passwd YourPassword
ExecStop=/usr/bin/killall x11vnc
Restart=on-failure

[Install]
WantedBy=multi-user.target

x11vnc.service

Step 7. Save file, Ctrl + O

Exit, Ctrl + x

Step 8. Enable and start x11vnc.service using following commands...

sudo systemctl daemon-reload
sudo systemctl enable x11vnc.service
sudo systemctl start x11vnc.service

Step 9. Verify VNC is running and what port is being used...

sudo systemctl status x11vnc.service

VNC Status Image

Step 10. Reboot your Linux PC and try to remote in via VNC...

Remote Access to VNC

VNC Password

Login Screen

After entering your credentials on Debian login screen, if you receive following error message...

VNC Error Message

Install Debian Desktop Environment on your Debian PC using following commands...

sudo apt install tasksel

sudo tasksel

Debian Tasksel

After installation, reboot your system...Try accessing the system again.

sudo reboot

Once you confirm everything is working correctly as expected, it's recommended to use VNC over encrypted SSH Tunnel.  Especially if you are planning on accessing your PC from outside of your network.  Here are the steps to configure SSH.

Step 1. Make sure you have Putty installed.

Step 2. Open putty and configure session as shown below...

Putty SSH Configuration

Step 3. Configure SSH Tunnel in putty as shown below...

Putty SSH Tunnel

Step 4.  Connect and login to your remote PC via SSH prior to connecting via VNC.  Keep the SSH session open while you are using VNC.

Putty SSH Session

Step 5. Remote desktop your Linux PC via VNC

Remote Desktop via VNC

Following message may appear stating that your VNC session is not secure, you can just ignore that message...

Putty VNC Session

Now you have successfully configured your VNC over encrypted SSH tunnel.  Cheers!

Putty SSH Configuration