Headless VNC Server on Raspberry Pi

I always wanted to know how to launch at startup the VNC Server on a headless Pi without connecting in SSH first to enter command manually.

It appears that 3 conditions are necessary:

  • To force the Pi to boot on desktop with autologin;
  • To setup manually a resolution for the Pi;
  • To activate VNC at boot;

And all these options can be enabled in the “raspi-config” menu.

pi@raspberrypi:~ $ sudo raspi-config

Then in “Boot Options” -> “Desktop / CLI”, we choose “Desktop Autologin”

To setup the resolution: “Advanced Options” -> “Resolution” -> “DMT Mode 85 1280×720 60Hz 16:9”. It’s the one I choose, you can pick up the one you want.

And finally, to activate at boot: “Interfacing Options” -> “VNC” -> “Yes”

Then, on VNC Viewer, you just have to connect with your local IP for the Pi followed by :0 or nothing for no desktop specified.