Installing Linux on your Pi
We will use Raspbian as the operating system on our Pi. My choice is solely based on the fact that it is recommended by the Raspberry Pi Foundation. It is based on the Debian version of Linux and optimized for Raspberry Pi hardware. Apart from being the most used operating system for Raspberry Pi, it contains almost 35,000 packages, such as games, mail servers, office suite, internet browsers and so on. At the time of writing this book, the latest release was dated May 5, 2015.
There are two main ways of installing Raspbian. You can either use the OS image as a whole or you can begin with an easy-to-use tool-operating system bundle called NOOBS. We will cover both cases here.
Note
There are SD cards for sale with NOOBS or Raspbian already installed. It might be a good idea to get one of these and skip the OS installation part of this chapter.
However, before we begin, we might need to format our SD card as previous OS installations may corrupt the card. You'll notice this if only a fraction of free space on the card is shown to be available even though you have formatted the card using the formatting utility provided by your computer's OS. The tool we will use is called the SD Formatter and is available for Mac and Windows from SD Association at https://www.sdcard.org/downloads/formatter_4/index.html. Install and start it. You will see the following interface asking you to select the SD card location:
The latest version of NOOBS can be found at http://downloads.raspberrypi.org/NOOBS_latest. Download and extract the contents on to the SD card. Attach the card to your Pi and connect it to a screen using an HDMI cable. Do not forget to connect the USB mouse. When the Pi is attached to a power source, you will be presented with a list of choices you can make. Check the Raspbian installation option on the list, and then click on Install. This will install Raspbian on your SD card and restart the Pi.
Installing using a Raspbian image
The latest version of the Raspbian OS can be found at http://downloads.raspberrypi.org/raspbian_latest. The ZIP file is almost 1 GB in size and contains a single file with an .img
extension, which is 3.2 GB in size. Unzip the contents and follow the steps in the next section to extract it to a suitable microSD card.
Extracting the OS image to an SD card
To extract an image file, we need a disk imaging utility and we will use a freely available one called Win32 Disk Imager on Windows. It can be downloaded at http://sourceforge.net/projects/win32diskimager/. On Mac OS, there is a similar tool called ApplePi Baker available at http://www.tweaking4all.com/hardware/raspberry-pi/macosx-apple-pi-baker/. Download and install it on to your computer. The installation will contain an executable file, Win32DiskImager
, which you should start in the administrator mode by right clicking on it and selecting Run as administrator.
In the Win32 Disk Imager window, you should choose the image file you've extracted and the drive for SD card similar to what is shown in the following screenshot:
Clicking on the Write button will start the process and your SD card will be ready to be inserted into the Pi.