Step 3: installing Linux on my Raspberry PI

Raspberry PI can support many Linux versions optimised for the ARM processor that’s built into the motherboard. Many of those versions are derived from the most popular PC versions – for example “Pidora” from Fedora, or “Raspbian” from Debian. The project website contains a list of available Linux versions for Raspberry PI.

In the previous articles we covered how to get your Raspberry PI and how to set it up. It is now time to install the operating system. We at 2ndQuadrant Italia are particularly fond of Debian systems. We downloaded then the Raspbian version: from the official site linked above it is possible to download a zip file containing the image of a Linux Debian 7.0 wheezy, optimised to work with the ARM architecture. This operation should be done from another PC, with an SD reader port to copy the unzipped image of the operating system into the SD card.

Be aware that a simple copy of the image on the SD disk is not enough: it already includes a preliminary partition where /boot, / and operating system are stored, so it cannot be copied inside a particular preexisting partition of the SD card. Below some key-steps for the installation are listed.

Raspbian installation

In order to transfer the Raspbian image on the SD card, we have used a PC with Ubuntu as operating system. Our PC did not have a SD reader, so we used an external USB SD reader (if this is your case too, remember to insert the SD card into the USB reader before plugging it into the USB port). Here follows a summary of the tasks we did:

  • Download the zip file containing the image from the Raspberry PI repository
  • Optionally, verify that the hash key of the zip file is the same as shown on the downloads page using the sha1sum command
  • Extract the image with the unzip command
  • Insert the SD card into the SD reader port. To find the name of the device, run the df command before and after inserting the SD card. The device that wasn’t present the first time identifies your SD card. Note that the SD card can show up more than once in the output of the df command (the device name of SD card will be listed with the last part indicating the partition number): in this case, as mentioned above, the partition of the device has to be unmount with the umount /path/of/the/device/with/partition command. If your SD card shows up more than once, you should unmount all of these partitions
  • Make sure the device name is the name of the whole SD card as described above, not just a partition of it, relaunching the df command. Then, write the Raspbian image (.img file) into the SD with the dd command. Something like: dd bs=4M if=/path/to/raspbian.img of=/path/of/the/device. Block size set to 4M will work most of the time. If not, please try 1M – although 1M will take considerably longer
  • As root run sync: this will ensure the write cache is flushed and that it is safe to unmount your SD card with the umount /path/of/the/device command.

Now it is possible to remove your SD card from the card reader and insert it in your Raspberry PI.

In the next post we will show you how to get started with it!

One thought on “Step 3: installing Linux on my Raspberry PI

  1. Pingback: Step 2: setting up my Raspberry PI | Raspberry PG

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>