Introduction: Install Raspbian and Setup Wi-Fi Without Access to Command Line or Using the Network Cable on Raspberry Pi Zero W

About: Raspberry Pi fan.

If you have a Raspberry Pi Zero W (or other model) like me and you can’t connect a keyboard or screen to it. And also the Pi Zero W doesn’t have a ethernet port. You will need to do the setup a bit different.

In this tutorial I will follow all the steps to setup Raspbian Jessie Lite on your Raspberry Pi (Zero W or other) so in the end you can connect to it via SSH.

Step 1: Download the Raspbian Stretch Lite Image

The best place to download the raspbian Stretch Lite image is to go of raspbeerypi.org website in download section. This is the link: https://www.raspberrypi.org/downloads/raspbian/

From there choose the image without Desktop version because we will not need it and click Download Zip.

When I write this is instructions the last version is September 2017, but you can download the latest that it's available.

Step 2: Download Etcher

We need to write the raspbian image that we downloaded in previous step to the SD card. To do we will need a software that knows to do this.

The best software available that is free and very lite is Etcher. Go here and download it: https://etcher.io/

Step 3: Flash the Image to SD Card

Connect the SD Card to your computer

Open Etcher and choose the image file (.zip file) that you just downloaded, choose the SD card drive and click Flash!

Now wait until the flash is completed.

Step 4: Setup Wi-Fi Without Keyboard or Network Access

If you have Raspberry Pi Zero W like mine probably you will need to use some adaptors to connect a USB Keyboard and a HDMI Screen, but in case you don’t have those adaptors or you don’t have a USB Keyboard or Screen you can set-up to connect to your local Wi-Fi network from another computer and after that just pop-in the SD card, power-up the Raspberry Pi and it will automatically connect.

So to do this, after Etcher completed to flash the Jessie image to the SD card do the following:

  • With the SD card connected. In the root of the SD card create a new file named: wpa_supplicant.conf (If you use a *nix platform the file probably it's here /Volumes/boot/
  • In the file you should add something like this:

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

network={ ssid="YourNetworkSSID" psk="Your Network's Passphrase" key_mgmt=WPA-PSK }
  • country should be your country code. Change if you are outside of US
  • ssid is the name of the Wi-Fi network.
  • psk is the password of your Wi-Fi Network
  • key_mgmt usually it’s WPA-PSK, can have other values like WPA-EAP, but you should be ok with WPA-PSK in most cases.

After you finish this steps your Raspberry Pi will automatically connect to your Wi-Fi when you pop-in your SD card and power-up.

Step 5: Setup SSH Access

But the problem is that you still can’t access the Raspberry Pi. You will also need to setup SSH access so you can connect to your Raspberry Pi from other computers from the same network.

You will need to have your SD card connected to your computer again and this is a really simple step

  • Create an empty file in the root of the SD card named ssh (without dot or extension).

This will enable ssh on your Raspberry Pi so you will be able to connect next time you plug in the Raspberry Pi. After that I put the SD card into my Raspberry Pi Zero W and plug in the Power cable (the one named PWR) and wait a little bit so the raspberry boot and connect automatically to Wi-Fi.

Step 6: Find the IP Address of the Raspberry Pi

In order to connect via SSH to your Raspberry Pi you will need to know the local IP of the Raspberry. To do this you can go to your router settings. Usually this is 192.168.0.1 or something like that. If you don’t know check on your router to find the IP address, username and password. After you successfully connect to your router go to Connected Devices and you will see something like raspberrypi. Mine looks like this.

From here I can find my Raspberry Pi IP Address. Mine is: 192.168.0.143

Step 7: Connect Via SSH

Now open a Terminal window a type:

ssh pi@192.168.0.143

pi is the default username on your Raspberry Pi. You will use this for the first time, after that you can change if you want to. Also make sure you will use the IP address that you just found on the previous step. It will ask you: “Are you sure you want to continue connecting (yes/no)?”. Type yes and hit Enter

After that it will ask for the password. The default password is: raspberry

Step 8: Change the Default Password

As you can imagine all the raspberries have the same username and password by default. You should change your default password right at the beginning with a more secure one. This is a very simple step.

  • Just type passwd after you connect to your raspberry using the pi username
  • Type the current password: raspberry
  • And type the new password two times

Next type you will connect to your Raspberry use this new password.

Step 9: Update Packages

To be sure that you have the latest packages with all the security fixes up to date you should run:

  • sudo apt-get update — To update the list of available packages and last version of each package
  • sudo apt-get upgrade — To upgrade the packages to the latest version. Probably the prompt will ask you to confirm. Type Y and hit enter.

That’s it. Now you should have a Raspberry Pi Zero W connected to your local network, accessible via SSH from other computers and with the latest version of packages.