Headless deployment lets you use your Raspberry Pi without a monitor or keyboard. You control it remotely, saving space and making setup easier.
Headless deployment setup in Raspberry Pi
1. Prepare Raspberry Pi OS image on SD card. 2. Enable SSH by creating an empty file named 'ssh' (no extension) in the boot partition. 3. Configure Wi-Fi by adding a 'wpa_supplicant.conf' file in the boot partition with network details. 4. Insert SD card into Raspberry Pi and power it on. 5. Connect to Raspberry Pi via SSH using its IP address.
The 'ssh' file has no extension and no content; it just enables SSH on boot.
The 'wpa_supplicant.conf' file must have correct Wi-Fi details and proper formatting.
Create empty file named 'ssh' in the boot folder: touch /path/to/boot/ssh
Example 'wpa_supplicant.conf' content: country=US ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="YourWiFiName" psk="YourWiFiPassword" key_mgmt=WPA-PSK }
SSH into Raspberry Pi:
ssh pi@192.168.1.100This script enables SSH and sets Wi-Fi on the Raspberry Pi SD card. After running it, insert the SD card into your Pi and power it on. Then connect via SSH.
# This is a shell script example to prepare SD card for headless setup BOOT_MOUNT=/media/$USER/boot # Enable SSH sudo touch $BOOT_MOUNT/ssh # Create wpa_supplicant.conf with Wi-Fi details cat <<EOF | sudo tee $BOOT_MOUNT/wpa_supplicant.conf country=US ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="HomeWiFi" psk="password123" key_mgmt=WPA-PSK } EOF # Inform user echo "SD card prepared for headless Raspberry Pi setup."
Make sure your computer can read the Raspberry Pi boot partition (usually FAT32).
Find your Raspberry Pi's IP address using your router or network scanning tools.
Default username is usually 'pi' and password 'raspberry' unless changed.
Headless setup lets you control Raspberry Pi without extra devices.
Enable SSH by adding an empty 'ssh' file to the boot partition.
Configure Wi-Fi by adding 'wpa_supplicant.conf' with your network info.
Connect remotely using SSH once the Pi boots up.