By following the instructions below, you can create a headless Raspberry Pi (without a monitor and a keyboard) that’s ready for remote access over SSH.
Install Raspbian OS
On your computer, download Raspbian Buster Lite (or other latest version) image from the Raspberry Pi website.
You’ll also need to download Etcher, a tool used to write OS images to an SD card.
Start Etcher, insert SD card, select the downloaded Raspbian zip file and click “Flash!”.
Connect to WiFi network
Create a file named wpa_supplicant.conf
in the root of the boot partition on the SD card, with the following contents:
country=XX
update_config=1
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="wifi-name"
psk="wifi-password"
}
Change XX with the two-letter ISO code of your country. Also, change the value for the ssid to be the name of your wireless network and psk to be your network’s password. If you have a more complex network setup, check out the official documentation.
There are two partitions on the SD card; boot is the smaller one.
Enable SSH
Create a file named ssh
(without extension) in the root of the boot partition on the SD card. This flags the Raspberry Pi to enable the SSH system on the next boot.
Connect over SSH
Once the SD card is prepared, insert it into an SD card slot on a Raspberry Pi and connect the power. Wait a few seconds for it to start up.
Now you’ll need to find out the IP address assigned to your Raspberry Pi. For example, you can use your router’s UI and see the list of connected devices.
To connect use the following command with the proper IP address:
ssh pi@192.168.1.10
The default password is raspberry. Once logged in you can change the password using the passwd
command.
If you are using Linux or MacOS on your computer, you can use ssh from the console/terminal. On Windows, you can use PuTTY or install WSL.
Configure static IP address
Edit the file/etc/dhcpcd.conf
and at the bottom of the file add the following lines:
interface wlan0
static ip_address=192.168.1.10/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
Change the ip_address value with the address you would like to use.
Reboot the Raspberry Pi:
sudo reboot
Update Raspbian
From time to time it’s good to check for and install updated packages to get security updates and new versions.
sudo apt update
sudo apt upgrade