lots of tech info here

How to Install Raspbian on Raspberry Pi Zero W

This tutorial will show you how to install Raspbian on Raspberry Pi Zero W using the command line.

A Raspberry Pi Zero W has a built-in wifi and Bluetooth. There is no built-in storage, so you will have to use your own microSD card. Look for Class 10 cards with at least 8GB capacity, preferably a 16GB microSD card. You will install Raspbian on the microSD card.

Download the Raspbian Jessie image zip file from this link.

https://www.raspberrypi.org/downloads/raspbian/

If you want the GUI version, download the zip file that says RASPBIAN JESSIE WITH PIXEL. If you want the non-GUI text-based version, download the zip file that says RASPBIAN JESSIE LITE.

After downloading the zip file, unzip it. Your image file will be either 2017-04-10-raspbian-jessie.img or 2017-04-10-raspbian-jessie-lite.img.

Create a directory ~/iso if it doesn't already exist. Move the Raspbian image file there.

Now, insert the microSD card into its adapter and into your computer. The card name show up on the desktop. My new PNY 16GB microSD card shows up as "NO NAME".

Write the image to the microSD card. If you want to do it using the command line, fire up Terminal if you're on a Mac or Linux.

Enter this to find the device list:

  df -h

You will get something similar to this:

aruljohn:~/iso👻 $ df -h
Filesystem                          Size   Used  Avail Capacity iused      ifree %iused  Mounted on
/dev/disk1                         465Gi  247Gi  218Gi    54% 1609478 4293357801    0%   /
devfs                              184Ki  184Ki    0Bi   100%     636          0  100%   /dev
map -hosts                           0Bi    0Bi    0Bi   100%       0          0  100%   /net
map auto_home                        0Bi    0Bi    0Bi   100%       0          0  100%   /home
localhost:/AB9NdpAfrugkKsX2qHKtPs  465Gi  465Gi    0Bi   100%       0          0  100%   /Volumes/MobileBackups
/dev/disk2s1                        14Gi  2.3Mi   14Gi     1%       0          0  100%   /Volumes/NO NAME

As you can see, the last line /dev/disk2s1 represents the microSD card. The card is mounted as disk2. Let us unmount it first.

  sudo diskutil umount /dev/disk2s1

It will unmount the card. Now, write the image to the SD card. Make sure that you enter the of value to the right disk number, which in this case is disk2.

  sudo dd bs=1m if=~/iso/2017-04-10-raspbian-jessie.img of=/dev/rdisk2

You will see output similar to this:

1237+1 records in
1237+1 records out
1297862656 bytes transferred in 253.226122 secs (5125311 bytes/sec)

That means Raspbian is written successfully to your card.

If you do not want to enable SSH or wireless network, you may eject the card after issuing this command.

  sudo diskutil eject /dev/rdisk2

The output will be this:

Disk /dev/rdisk2 ejected

Congratulations! You have installed Raspbian successfully!

Enable SSH on the Raspberry Pi

If your card is still in the computer, go to the next step. If you have removed the card, put it back into the computer. When the computer recognizes the card, it will show up as boot.

Double-click on boot and create an empty file named ssh* in boot. If you want to use the command line to create an empty file, follow this step:

If you're using a Mac, type this:

  echo '' > /Volumes/boot/ssh

You will see an empty file called ssh under the boot partition of the card. SSH will be enabled on the next boot.

Connecting the Raspberry Pi 1, 2, 3 or Pi Zero W to the wireless network

Create a file called wpa_supplicant.conf under boot and enter the contents as follows:

network={
    ssid="YOUR-NETWORK-NAME"
    psk="YOUR-NETWORK-KEY"
    key_mgmt=WPA-PSK
}

You have to customize the above file using your credentials. Make sure the values for ssid, psk, key_mgmt are valid.

When everything is over, eject the card.

  sudo diskutil eject /dev/rdisk2

Now, put the card in the Raspberry Pi and turn on the Raspberry Pi. It will hopefully connect to the wireless network. You can connect to it using this command.

  ssh pi@raspberrypi.local

The default password is raspberry. After you login, be sure to change the password with a passwd command.

Posted on 23 May 2017

If you liked this article, follow us on Facebook and Twitter (@aruljohn).

Share this with Others

Subscribe

Tags