Raspberry PI Raspbian Stretch Headless setup (no keyboard, mouse or monitor)

The Raspberry PI is such a great computer. Its small size enables us to do a lot with it. Because it’s so easy to setup and put it to work, we want to do it faster, without the hassle of having to connect a keyboard, mouse and monitor to work it it.

Here’s how to put the image on the SD card, configure WiFI and enable ssh – all without monitor, keyboard and mouse.

Requirements

  • Raspberry PI – any version
  • WiFI dongle – Raspberry PI Zero W (and Zero WH) , Raspberry PI 3 (and 3+) already have WiFI
  • SD Card reader
  • SD Card (4G or more)

Installing images

Just head to the Raspberry PI Downloads page and download a image.

Next, you need to write the image to a SD card.

You can use Etcher for Linux, Windows and MAC if you like graphical tools.

I’m a big fan of using dd. But, let’s use Etcher .

First, insert the SD card in the SD card reader and execute Etcher.

Select an Image

Select the SD card

Flash it

After finishing it, if two drives don’t appear, just remove the reader (or if not USB Reader, remove the SD card) and insert it again.

Edit the files

After the image is on the SD card, you should be able to mount the boot partition. The boot partition is FAT32, so any computer can mount it.

Enable ssh

To enable ssh, in the boot partition, just create an empty file named ssh.

WiFI

To enable WiFI, we have two options.

First option (fastest)

In the boot partition, create a file named wpa_supplicant.conf with your WiFI configuration in it. Here’s an example for WPA2 PSK

Up on boot, if this file is present, Rasbpian will move it to the correct place ( /etc/wpa_supplicant directory) and will connect to your WiFI network.

You can find more info in the Raspberry PI Documentation for other WiFI configurations. How-To Geek website also has a great page on this.

Second option

If you’re using a Operating System that can recognize Linux Partitions, you can mount the Rootfs partition and edit the wpa_supplicant.conf file directly .  You’ll need to be root for this.

Finishing

Umount the SD card from your machine and put it in the Raspberry PI. Boot the raspberry PI – wait a couple minutes because the SD card is resized in the first boot.

Find the IP of your Raspberry PI and ssh into it !

Using a Raspberry PI is getting easier and easier !

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.