I recently purchased a few Raspberry Pi 4’s and didnt want to connect them to a Monoitor/Keyboard etc.. So I looked into a way to deploy the OS/Config with the ability to SSH onto them to complete any further configuration.

My initial purchase included:

  • 2 x Raspberry Pi 4 Model B (2GB RAM)
  • 2 x 16GB Micro SD Cards
  • 2 x Official Raspberry PI 5.1v/3A Power Supplies

First thing to do was to obtain the Raspbian Image, which can be downloaded from HERE

To install the Image, I downloaded and installed Balena Etcher from HERE

I use a MAC, so I first formatted the SD Card using the Disk Utility to MS-DOS (FAT)

1

Open up Etcher and select the Downloaded Image

23

Once you have chosen the image and selected the SD Card as the Target, Click Flash!

4

Once this is completre, we are going to create a file to allow SSH connectivity to the PI:

Remove the SD Card from your Computer and re-insert. When you can see the Card Mounted, navigate to the /Volumes/boot partition and create a file called ssh

5

Then we will create a file to store Network configuration, so the Pi will automatically connect to the WiFi:

Create a file called: wpa_supplicant.conf in the same directory

6

Copy the following Text and Modify the Country Code, Network Name (Your SSID) and the WiFi Password:

country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid="NETWORK-NAME"
psk="NETWORK-PASSWORD"
}

Copy the edited config and open up the wpa_supplicant.conf file using a Text Editor (I used VI, so dont forget to enter Insert Mode) and pasted it in.

7

Save the File (In VI: <ESC> :wq!) and exit the Terminal

Eject the SD Card and Insert into the Raspberry Pi.

Power up the Pi and wait a few minutes. The PI will connect the Network and get an IP Address from DHCP. To find out what Address it had been given, you can check from your Router or I used Zenmap.

I ran a scan on the Local network, which shows all the connected Devices – the Raspberry PIs are obvious as the MAC Address shows (Raspberry Pi Trading)

9

You can see that Port22 is open for SSH connectivity

10

Now I can connect to the Pi using ssh and the default credentials:

Username = pi
Password = raspberry

11

You could go on a perform other configurations from here, but the last thing I will do for this post, is to expand the Filesystem to fill the entire SD Card

From the CLI, type:

sudo raspi-config

Select A1 Expand Filesystem

12

You can see this has now expanded across the entire 16GB Card

<13