Installing Raspbian on a Raspberry Pi

Why?

I was working on a project to wire up a Raspberry Pi to a DHT-11 temperature when I needed to test the connection using Python. I was intending to make it an Elixir/Nerves project, but I needed to test that my wiring was good before I tackled some issues on Elixir. So I decided working from a “known state” with Raspbian and Python would make sense. Here are the installation instructions for getting Raspbian running on a Pi. Its really handy to have an Raspbian SD card in case you need to test something out with a full operating system. We’ll also see how to SSH to the Pi afterwards.

Parts

  • A Micro-USB cable or whatever cable required to power your particular Pi. Or a full blown power supply.
  • A raspberry pi. I’m using a pi 3. You might look at [CanaKit] (Optional) to provide the cables, pi, and other parts like I did.
  • An sd card that fits the pi

Installation

First, we need the Raspbian operating system. The full installation instructions are here, but I’ll of course walk you through it in a bit more concise fashion.

I opted for Raspbian Lite as I didn’t feel the need for a desktop, but you can download the version of your choice. Download Raspbian Lite

We then need to burn the image to an SD card with Etcher: Download & Install Etcher

You can unzip the image (using 7zip or a similar tool), but Balena Etcher will allow you to burn the image directly from the compressed file. Launch Etcher and install you SD Card.

The source will be the zip file we download, the target your SD card, then you can let it burn.

Once the SD card is burned, we want to make sure we can access it over SSH, unless you just want to hook up a keyboard and work locally. So before you remove the SD card, open a terminal and CD to wherever your SD card is mounted. On my Macbook Pro this was just cd /Volumes/boot/. Then do touch ssh. This will tell Raspbian to allow ssh access. Plug in your Pi to a power source and you’re ready to go.

Now that we have Raspbian installed we want to connect to it over SSH. To do so, you’ll need find its IP on your local network. For me, it was a simple matter of looking up the host in my router software.

It should show up on your router software as “raspberrypi” or something similar. I just had to do this:

ssh pi@192.168.1.19

Of course, you’ll have to put in your Pi’s IP address. The default password is raspberry.

And Voila, we’re connected!