Raspberry Pi zero w

How to Setup Raspberry Pi Without Monitor and Keyboard

It can be really helpfull to setup the Raspberry Pi for the first time without a monitor and keyboard. In the past it was always a bit cumbersome to set up a new Raspberry Pi. I had to get out an HDMI cable, a keyboard, a monitor and maybe a mouse. This always took a lot of time and had to be cleaned up afterwards. Now it is possible to do the initial setup conveniently on my computer without any additional hardware.

 

Hardware and Software

  • Raspberry Pi
  • MicroSD card with SD adapter (recommended capacity from 8 GB)
  • USB power supply (5V / 2A)
  • optional – USB WLAN stick (if a Raspberry Pi without integrated WLAN is used)
  • Etcher – in my opinion the easiest way to install images on SD cards or USB sticks (available for Linux, MacOS and Windows)
  • SD Card Formater
  • the current image of Raspbian Stretch (or Lite) from Raspberry Pi Foundation

Format SD Card or USB Flash Drive

Insert the MicroSD card in the adapter into the computer. Then you need a SD Card Formater software to format the SD Card.

 

Write Raspbian OS Into SD Card

If you have formated the SD Card you can click on “Select Image” in Etcher and select the Raspbian image you downloaded earlier (image does not need to be unzipped).

Etcher

Then use “Select Drive” to select the MicroSD card as destination. Etcher should automatically select the Micro-SD card as destination, but it is still recommended to check this, otherwise data on other drives could be deleted.

Etcher Target

Now click on “Flash!” to start the writing process.

 

If Etcher shows an error, reformat the MicroSD card. After the image has been successfully written to the MicroSD card, the following window appears:

Now you have to add two more files to the MicroSD card: SSH access file and the WLAN configuration.

Since the etcher ejects the SD card automatically after the image has been successfully written, remove the SD card and re-insert it into the computer.

Create an Empty File Named SSH

To enable SSH access, create an empty file named “ssh” (without file extension) in the directory of the MicroSD card (/boot).

Create an File for Wifi

To activate WIFI access, create a file in the directory of the MicroSD card (/boot) with the name “wpa_supplicant.conf” (the file extension here is .conf – do not put a .txt behind it, otherwise it will not work) with the following content:

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

network={
ssid="<Your_SSID>"
psk="<your_password>"
}

Replace the entries “<your_SSID>” and “<your_password>” with the values valid for your network and save the file.

First Start

Now safely eject the prepared MicroSD card from your computer and insert it into the Raspberry Pi. If your Raspberry Pi does not have an integrated WLAN, insert the WLAN stick and the microUSB plug from the power supply into the Raspberry Pi and start the Pi.

Wait a little while until the Pi has started up properly and check if the Pi is available via SSH. To do this ping the pi with the following command:

ping raspberrypi.local

(When connected to a Fritzbox, the command could simply be “ping raspberrypi” or “ping raspberrypi.fritz.box”)

The SSH Port is 22.

After the successful ping test, you can reach the pi via SSH. In Linux or OSX this can be done via terminal and in Windows via PuTTY. SSH access is done with this command:

ssh pi@raspberrypi.local

The default password for SSH access is raspberry.

 

Configuration

After you have established an SSH connection, a few configuration steps are required. To start the configuration tool, execute the following command:

sudo raspi-config

I recommend to change the default password. Why it is important and which further security steps are necessary for the Raspberry Pi you can read in my earlier post. To change the password, select the entry “Change User Password“.

Also recommended is the setting for using the full capacity of the MicroSD card. This can be done via the entry “Advanced Options -> Expand Filesystem”.

Now restart the Raspberry Pi so that the changes made are applied.

 

Update / Upgrade

Finally, the system still needs to be updated.

Set up the SSH connection to the Raspberry Pi again:

ssh pi@raspberrypi.local

Use the integrated package management to update the system. The following commands will do this:

sudo apt-get update && sudo apt-get upgrade -y

Now just perform a restart:

sudo reboot

Now is the Raspberry Pi set up and up to date.

Leave a Comment

Your email address will not be published. Required fields are marked *