RaspberryPi:Installation
Contents
Overview
In order to use the Pi you need to install an operating system on it and set up networking. You will then configure the networking settings on your Pi to allow you to access the Pi using SSH.
This process will follow headless installation, as we are going to assume most students do not have access to spare screens, keyboards and mouses for the Pi. Headless mode on the Raspberry Pi refers to using it without direct user input and output (essentially no screen, mouse or keyboard connected directly to it).
Prerequisites
Hardware Requirements:
- Raspberry Pi, and a means of connecting to it, such as an Ethernet Cable for a Pi 3b+ or a standard USB cable for the Pi Zero/ZeroW
- A micro SD card
- If you're using the Pi 3b+, a power source (the USB port doesn't provide enough current)
- A means of writing to the SD card, such as an SD card reader
Software Requirements
- An operating system image. It's recommended you use Raspbian. You can read more about operating systems for the Pi on this page
- Something to allow you to SSH in to your Pi. On Windows you can use PuTTY or WSL
- On Windows, you will need an SD Card Formatter
- On Windows, you will require software to burn the image. Balena Etcher is recommended.
Installation Process
- Preparing the SD Card
Plug your SD card in to your machine and format it. On Windows, this can be done using the SD Card Formatter linked in the Software Requirements section. - Burn the image to the SD card
Open Etcher. Select the downloaded zip image, and the SD card, and format. At the end of format, it may read that it failed, but don’t worry. Ignore the Windows popups about needing to format the SD card. Upon completion, Windows will try to mount partitions on the SD card that it can’t read. Just press “Cancel” and then “OK” to the dialog boxes that pop up. The boot partition is the only partition we will be dealing with. - Enable SSH
SSH is covered in detail in SSH, but for now just enable SSH by creating a file called “ssh” (no file extension) on the boot partition of the SD card. - Configure Networking
Please read through RaspberryPi:Networking. Configuring networking on the Pi depends on what Pi you are using. For example, if you're using a 3b+, you may want to connect via a static IP over Ethernet. If you are using a Pi Zero, you may want to connect over a USB to Serial or USB to Ethernet connection. In both cases, you will likely want to connect your Pi to Wifi through Eduroam. - Boot
Insert the SD Card into the Pi, and connect your Pi via the interface you are using - Ensure Connectivity
Try and ping the Pi's static IP, or view COM Port connections if you are using the Pi Zero Serial option. For example,
$ ping 192.168.137.15
You should see a response similar to
$ 64 bytes from 192.168.137.15: icmp_seq=1 ttl=64 time=0.557 ms
or
$ Reply from 192.168.137.15 bytes=32 time=0.5ms TTL=52
- SSH In to your Pi
$ ssh pi@192.168.137.15
You will be asked to add the machine to known hosts. Select yes. The default password for Raspbian is simply "raspberry".
- Change your password
To change your password, you can simply run$ passwd
- Enable Services
It's a good idea to enable useful services on the Pi.- On your Pi, run
$ sudo raspi-config
- Use the arrow keys and scroll down to “Interfacing Options”
- If not enabled, enable SSH, VNC, SPI, I2C and Serial
- Save and exit raspi-config by using the left and right arrow keys to jump to the bottom buttons. Your Pi will reboot.
- On your Pi, run
- Expand the Filesystem
The Rasberry Pi Installation may not make use of the full SD card. In order to give yourself as much file space as you have access to, you need to expand the filesystem.- SSH into the Pi
- Run
$ sudo raspi-config
- Use the arrow keys and scroll down to “Advanced Options
- Select "Expand Filesystem"
- You will be shown a message saying that the root partition has been resized. Select “Ok”, then “Finish” then “Yes” to reboot your Pi.
More detailed Information
If you need more detailed information on how to configure the SD card when using a different operating system (such as Mac), visit the Raspberry Pi Website