Here’s a clean, headless way to get a Raspberry Pi on Wi-Fi and enable VNC—no monitor needed.
What you’ll need
- A flashed micro-SD with Raspberry Pi OS (Desktop is easiest for VNC).
- Your Wi-Fi SSID, password, and country code (e.g., US/DE/CN).
- Another computer on the same network (to SSH in once).
Method 1 (recommended): Use Raspberry Pi Imager’s advanced options
Open Raspberry Pi Imager → choose OS (Raspberry Pi OS (32-bit)) and your SD card.
Click the gear (advanced):
- Set hostname (e.g., raspberrypi).
- Set username/password (no default user anymore).
- Enable SSH (use password or key).
- Set Wi-Fi SSID, password, country.
Write the card → insert in Pi → power it.
Find it on the network: try ssh @raspberrypi.local or use the router’s DHCP list.
Enable VNC via SSH:
sudo raspi-config nonint do_vnc 0
sudo systemctl enable --now vncserver-x11-serviced.service
If you installed Lite (no desktop), add VNC + desktop first:
sudo apt update
sudo apt install -y realvnc-vnc-server raspberrypi-ui-mods
sudo systemctl set-default graphical.target
sudo reboot
- On your PC, install RealVNC Viewer, connect to raspberrypi.local (or the Pi’s IP).
Method 2: Manual “boot partition” setup (if you can’t use Imager’s gear)
After flashing, open the SD card’s boot volume on your computer.
Create a file wpa_supplicant.conf (UTF-8, Unix line endings) with:
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="YourWiFi"
psk="YourPassword"
scan_ssid=1
}
(Change country, ssid, psk. Keep quotes.)
Create an empty file named ssh (no extension) to enable SSH.
(For newer OS builds) create a user non-interactively: add a file userconf containing
username:encryptedpassword
You can generate the encrypted password on Linux/macOS:
openssl passwd -6 'yourpassword'Eject the card → boot the Pi.
SSH in: ssh @raspberrypi.local (or by IP).
Enable/install VNC as in Method 1 step 5.
Quick tips & troubleshooting
- 2.4 GHz vs 5 GHz: Older Pi Zero/3 might only see 2.4 GHz. Ensure your SSID is on 2.4 GHz if needed.
- Wi-Fi country is required for some channels—set it correctly.
- If raspberrypi.local doesn’t resolve on Windows, use the IP address (or install Bonjour/mDNS), e.g. ssh user@192.168.1.123.
- Check Wi-Fi status: iwgetid, ifconfig -a, sudo rfkill list.
- If you used Lite, you need a desktop for full VNC X11 sharing (see install commands above). For CLI-only remote desktop, consider SSH + tmux or X11Forwarding.
That’s it—flash, preconfigure Wi-Fi + SSH, boot, SSH in, enable VNC, and connect from RealVNC Viewer.

Top comments (0)