Search This Blog

04 September 2012

Installing an operating system on a Raspberry Pi

Previous sections of this story:
So, in order to get the RPi up and running - you need to put an operating system onto your new SD Card.

In order to do this you need some way or writing to an SD card. Myself, I originally tried to use the SD Card slot in my MacBook Pro Laptop. I had been warned, by a colleague who had already set-up his RPi, that he had experienced trouble with his Mac Card Slot - so I was a little quick to give up on that option, when I had difficulty, and borrowed a friends USB SD Card writer.

Over the next weekend, without access to to the USB hardware, I discovered that the card slot in my laptop appeared to work just fine. Same brand of disk - only difference? the size... so that issue is, as yet, unresolved. Does the Mac card slot have trouble with some SD cards? I'm not sure.

Either way... once you have a reliable way of reading/writing from/to an SD card... the installation is fairly easy.

Other options I never tried

For other options, see the Raspberry Pi Downloads page. Apparently you can buy a preloaded card from RS Components, element14 or The Pi Hut's Raspberry Pi Store. But I can't vouch for these options.

Lots of other options for, apparently, easier ways to get installations can be found on the RPi Easy SD Card Set-up page. This page is also good it your are not, as I was, using a Mac to set this up.

What I DID do

I downloaded the Raspbian "wheezy" distribution.

Start with your SD card NOT plugged in.

Assuming your download is in a directory "~/Downloads/" - called "" - extract the image using the command:

unzip ~/Downloads/

Now - run this command... trust me, it'll make sense in a sec:

df -h

NOW - plug in your SD card (connect your USB card reader, etc.). Run the same command as above again, "df -h", and record the name of the device that wasn't there before. It will look something like:


Now you need to unmount the disk - replacing the reference, below, with the name of the device you recorded in the previous step:
sudo diskutil unmount /dev/disk3s1

You now need to work out the raw device name for the entire disk.

  1. use the device name you recorded above - for e.g. "disk3s1"
  2. omit the final "s1" and replace "disk" with "rdisk" - so "disk3s1" becomes "rdisk3"
    1. N.B.: this is very important: you will lose all data on some other device on your computer if you get the wrong device name

Use the "raw disk" name you worked out, above - for e.g. "rdisk3"... run the following command:

sudo dd bs=1m if=~/Downloads/debian6-19-04-2012/debian6-19-04-2012.img of=/dev/rdisk3

N.B. if the above command reports an error (dd: bs: illegal numeric value), please change bs=1M to bs=1m - this is, apparently, an odd Mac quirk - i.e. the "standard" command uses "bs=1m" but Mac implementation of the "dd" command usually require "bs=1M".

This will take a few minutes to run. If you want feedback on what's going on, type "ctrl-T".

Eject the card, using:

sudo diskutil eject /dev/rdisk3

And that was it.

Then you plug it into the, convenient, SD card slot in your new Raspberry Pi - and switch it on.

There are a few little set-up quirks to consider, built into the configuration of Raspbian - but we'll cover those in...

Continue: "Turning on the Raspberry Pi for the first time" >>

No comments: