Skip to content

Latest commit

 

History

History
108 lines (72 loc) · 2.35 KB

GUIDE.rst

File metadata and controls

108 lines (72 loc) · 2.35 KB

Configure a Raspberry Pi from scratch

Prepare

Use Rapberry Pi Imager to install Raspberry Pi OS Lite (64-bit) on an microSD card (32GB shall be fine, make sure it is class 10).

Use the configuration tool to

  • enable ssh on boot
  • connect to your wireless network
  • set the username and password

Connect

Connect to the Raspberry Pi via ssh.

ssh pi@raspberrypi.local

The default credentials are pi and raspberry.

Configure

Core configuration

# upgrade existing packages
sudo apt update
sudo apt upgrade -y

# install core packages
sudo apt install -y git wget vim build-essential checkinstall

# configure vim
cat << EOF >> $HOME/.vimrc
filetype plugin indent off
syntax on
set term=builtin_xterm
set term=xterm-256color
set number
set mouse=r
EOF

# raspi-config
sudo raspi-config nonint do_memory_split 16
sudo raspi-config --expand-rootfs
sudo raspi-config nonint do_hostname pibell
sudo reboot

Install Python core packages (apt)

sudo apt update
sudo apt install -y libatlas-base-dev
sudo apt install -y build-essential libssl-dev libffi-dev
sudo apt install -y python3 python3-pip python3-dev python3-venv python3-setuptools
sudo apt install -y python3-numpy python3-gpiozero python3-serial

Create and activate the Python venv

/usr/bin/python3 -m venv --clear --prompt py3 $HOME/.local
source $HOME/.local/bin/activate

Upgrade pip and install related packages in venv

pip install --upgrade pip setuptools setuptools_scm wheel

Add aliases and Python venv activation to ~/.bashrc

cat << EOF >> $HOME/.bashrc
# aliases
alias ls='ls -h --color'
alias l=ls
alias ll='ls -l'
alias la='ls -all'
alias vi=vim
alias status='systemctl status'
alias start='sudo systemctl start'
alias stop='sudo systemctl stop'
alias restart='sudo systemctl restart'
alias reload='sudo systemctl daemon-reload'
alias reset-failed='sudo systemctl reset-failed'

# Python3 venv
source "$HOME/.local/bin/activate"
EOF