Contributor(s): Peter Esser

Raspberry Pi - Installing the Operating System

Interested in Linux? Or in robotics? Raspberry Pi is your device!

This blog post will describe how to install Raspbian Stretch Lite on a Raspberry Pi to demonstrate, how easy the start into those areas can be!

It is a beginner guide and will focus on explaining the bare minimum.

Outline

  1. Pre-Requirements
  2. Install Raspbian Stretch Lite
  3. Login via SSH
  4. Follow up

Pre-Requirements

This post will focus on setting up a Raspberry Pi 3. This is what you need:

  • Raspberry Pi 3 Model B+ - I used this model since I already had it. This guide does also work on other models like the B+. (Obviously, you need a way of powering this Pi too.) You can buy a B+ here: Only mainboard *, All in one *.
  • Micro SD card - This SD will be used to store the operating system and our experiments. It needs to be bigger than 16 Gigabytes of storage. You could buy this one for example: SanDisk Ultra 16GB *
  • Micro SD card reader - Maybe obvious to one, but we need a way to write our operating system onto the SD card. You can find one here: MicroSD Reader *
  • Network access for Pi - The Raspberry Pi 3 Model B only supports LAN access.
  • Computer - We need a way of accessing our Raspberry Pi. Even though it is theoretically possible to control your Pi using a smartphone, we need a way of writing to the SD card. So if you don't own a computer but can access one once which has an USB port or SD card reader, you still can proceed.

Install Raspbian

Let's start by discussing the design decisions made for this step. I chose Raspbian Stretch Lite (the latest version, June 2018 (Reference 1)) mainly for two reasons: First and foremost, this version of Raspbian is lightweight (bare minimum of applications preinstalled). This allows us to focus the already pretty minimal computing power on the experiments we want to run. The second reason is that there are only a few different operating systems for the Raspberry Pi and for the things we plan on doing with it, it shouldn't affect us too much.

Download the OS

Visit this link and download the latest version of Raspbian Stretch Light (I am using the version published on 2018-06-27. This specific version can be downloaded here, but I would recommend downloading the newest version as it could contain performance improvements and bug fixes. After downloading this file, you have to extract the file within this ZIP file.

Burning the image

DISCLAIMER: Everything you do, is on your own! This also means, that you have to make sure, that the SD card does not contain any data! Be sure to check the card before proceeding! The card will be formatted/deleted when proceeding!

The next step is writing the OS to the SD card. How you do so depends on the operating system you are currently working on. Here are the three main OS listed; just proceed with the corresponding one:

Windows

The process of burning an image on a Windows machine can be somewhat tricky... First of all, you will need a program called Win32DiskImager. This program can be downloaded here. Although I recommend using the latest version if possible, Win32DiskImager version 1.0 did not start on my personal machine. That's why I had to download and install version 0.9.5 (This can be found here). Although it did prompt an error on startup I didn't have any errors afterwards and it worked fine for burning the image to the SD Card.

The actual burning is now a matter of a few clicks so please make sure the SD Card is empty before continuing.

Insert your SD card into your computer and remember the volume-letter windows assigns to it. After that, start Win32DiskImager as administrator (by right-clicking its icon). Now navigate to the image file you downloaded after pressing the little button next to the text field. With the image selected, choose the device letter from the drop-down menu on the top right of the screen.

The next step is to confirm the burn. After you hit the "Write" button, the program will format (and delete) the SD card, create two partitions (needed for the OS) and write the image to the card. Since Windows is not able to read Linux storage systems, it will prompt a window asking to reformat the SD card. You have to cancel this prompt. After this step is done, go to here before removing the SD card.

MacOS and Linux

I recommend using a tool called Etcher, which can be downloaded here. This tool is very easy to use and involves four steps:

  1. Open the downloaded program
  2. Select the image you downloaded
  3. Select the SD card that you want to flash
  4. Click Flash Disclaimer: The SD card will be deleted entirely.

After this the program does its magic and flashes the SD card.

Enable SSH

After the SD card has been burnt, you will see a partition called BOOT when looking at your devices. We now have to create one specific file so that we can access the Raspberry Pi without hooking up an external monitor and keyboard (this process is referred to as headless setup).

Simply create a new file called "ssh" and place it inside the BOOT partition. Make sure your file is called "ssh" with no file extension at the end.

If you want to use Wifi: Make sure to visit this link to find out, how to enable Wifi in headless mode for your device.

Login via SSH

To make sure everything works like expected we want to login into our Raspberry Pi using SSH. This is the last step that depends on your operating system. Here is a list of the credentials you will need:

hostname: raspberrypi
username: pi
password: raspberry

For Windows users

If you are using Windows 10, you can install a hidden feature called "OpenSSH". (For those of you who don't using Windows 10 please visit this link to learn how to connect using SSH.) OpenSSH can be enabled in several steps which can be found here: link. Once enabled, open the command line (pressing "Win-Key + R" and entering "cmd"). Then proceed as the Linux and Mac users.

For Linux and Mac users

First, plug in the network and the power cord into your Raspberry Pi and wait for one minute. Open the terminal and type

ssh [email protected]

and enter the password "raspberry". After a prompt telling you the RSA fingerprint was not recognized (expected) and you are sure you can trust that device, you are logged into your Raspberry Pi and it should look something like this:

[email protected]:~ $

Finally!

Follow up

After we have a Raspbian setup on a Raspberry Pi we are able to install the packages needed for machine learning. I will show you how in one of the next posts I publish. Until then, Have a good time and keep learning!

Reference 1: Authors of raspberrypi.org. "Raspbian". Internet: https://www.raspberrypi.org/downloads/raspbian, Jun. 27, 2018 [Sep. 03, 2018].


* Everything followed by a star (*) is a link from the Amazon Partner program. This program allows me to earn a little bit of money, if you buy a product after clicking this link. Note that this does not effect the price of the product, so you have no disadvantage using this link. Learn more here!