Complete OS Setup Guide

Getting the OS ready

To get the Operating System ready, you need a raspberry pi with the following installed on it:

raspbian

This section will outline the necessary steps to get a raspbian image up and running on your raspberry pi. Here are the steps you take:

  • Download the 'Raspbian Buster Lite' image here.

  • Using the Balena Etcher utility, flash the downlaoded image to an SD card.

    • If you want to enable ssh by default, now is a good time. After the image is transferred to the SD card, and the card is still connected to your computer, add an empty file called ssh to the boot directory on the SD card.

  • Place the SD card into the Pi, connect it to the network and turn it on.

    • Having a keyboard connected to your Pi for these initial steps, might make things a little easier. However, if you are familiar with ssh, most of this tutorial can be done using a remote shell (with the exception of launching the UI once you are ready)

    • The default username is pi and the password is raspberry

    • On first boot you will want to use the raspi-config utility to change a few things.

      • By default, the Raspberry Pi is configured for English (UK). You should change your keyboard layout for your locale (or you may find your keyboard entering characters you didn’t expect).

      • You can also enable ssh through this config tool (if you haven’t already).

      • To find these settings (and more) simply run raspi-config after logging in. For more help with this tool, you can visit the help page found on the Raspberry Pi site.

When running most of the commands in this guide, you will need to have elevated permissions. The simplest way to do this is to type sudo before each command. Alternatively, you can run the sudo su command and then all subsequent commands will be run with "root" priviledges.

docker

These are the commands to get docker on your raspberry pi:

curl -fsSL https://get.docker.com | sh
usermod -aG docker pi

systemctl enable docker # make sure it starts at login

docker-compose

These are the commands to get docker-compose on your raspberry pi:

apt update
apt -y install python3 python3-pip libffi-dev
pip3 install docker-compose

reboot

web browser and window manager

These are the commands to get the chromium web browser and the i3 window manager on your raspberry pi:

apt update
apt install -y chromium-browser i3 xserver-xorg xinit

reboot

Once i3 is installed, you will need to set it up to launch on login.

First we need to create i3’s config file:

mkdir .i3
cp /etc/i3/config .i3/config

Then you need to create a file called .xinitrc (in the pi user’s home directory) with the following contents:

#!/user/bin/env bash

screenshutoff
exec i3

Once created, you need to give the file execute permissions:

chmod +x .xinitrc

And last, you need to create a file called .bash_profile (also in the pi user’s home directory) with the following contents. This will launch i3 whenever you login as the pi user from the console (but not through ssh).

if [[ -z $DISPLAY && $(tty) == /dev/tty1 ]]; then
        startx -- -nocursor
fi

source ~/.bashrc