Cheatsheet for Setting up Pi Devices
Table of Contents
Nowadays it is quite easy to deploy open-source projects on a well-configured server, especially those in the Python ecosystem. However, it is not “that” easy if you need to setup a development board from scratch, especially for new beginners. Even an expeirenced developer might need to deal with possible exceptions. Anyway, it’s always good to have a TODO list to ensure the setup process is quick and nothing is missed —— so comes this cheatsheet.
This is mostly based on my personal development requirements. It is best applicable for boards like Orange Pi and Raspberry Pi.
Hardware
Network connection
Wired or wireless
Keyboard, mouse, and display
For first-boot setup and local debugging
TF (MicroSD) card with OS flashed
- Ubuntu latest LTS recommended for general development
- I prefer server OS over desktop ones cuz it’s more lightweight
- It also prevents the GUI affecting performance measurement
- If money allows, buy a larger card yourself (>=256GB in my case)
- The default 32/64GB is insufficient for many tasks
- Imaging tools: BalenaEtcher (general), and Raspberry Pi Imager (R Pi)
- R Pi Imager supports headless setup through customized configuration
System
Set/change the username and password if required
- Recommended format: device (raspi, orangepi) [+ user info (if not shared)]
Connect to the (wireless) network
- On R Pi, you can perform a headless setup to automatically connect
- The network is managed by
cloud-init
,netplan
, andnetworkd
by default. - I switched to
NetworkManager
as it’s more familiar.
- The network is managed by
- On others, use the
NetworkManager
with Ubuntu- Detect available networks:
nmcli dev wifi
- Connect by ssid:
nmcli dev wifi connect <ssid> password <passwd>
- Detect available networks:
Configure the network if required
- Tsinghua TUNET authentication: GoAuthing
- If there’s proxy issue to access GitHub, it’s available on TUNA
- Linux arm64 pre-built binaries: auth-thu.linux.arm64
- Setup the proxy: TODO
- Make sure not to allow LAN connection in public network
Install/update necessary packages
- Switch sources when needed
- Update and upgrade first:
sudo apt update && sudo apt upgrade
Setup SSH server for remote access
sshd
to launch the SSH serverifconfig
to view the device IPssh -p <port> user@ip
to test loginssh-copy-id
for key auth
Others
(Optional) use vendor-provided tools like raspi-config
(for Raspberry Pi) and orangepi-config
(for Orange Pi) for more interactive configuration.
Environment
Basic tools and packages
- tmux:
sudo apt install tmux
- git:
sudo apt install git
- Copy SSH public key to GitHub to clone with SSH
- Config username and email to commit
- code-server (if platform doesn’t support VSC Remote)
Build tools and compilers
- CMake (>=3.22 for most projects)
- Install via apt:
sudo apt install cmake
- Install from official website: download page
- Update to latest: CMake update
- Install via apt:
- GCC
- Install via apt:
sudo apt install build-essential
- Install via apt:
- LLVM + Clang
- Install from official website: download page
- One-liner to install latest:
bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
- Note: when multiple compilers (GCC, Clang, and different versions) are installed, make sure the
$CC
and$CXX
enviroment variables are correctly set, or the building tools (e.g., CMake) might use the wrong compiler and cause errors
Python environments
- Miniconda
- Preferred for most cases
- One-liner installation (mind the OS and arch)
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh
bash ~/Miniconda3-latest-Linux-aarch64.sh
- No
sudo
or will be installed to another location
- No
- Press Enter and type yes after reading the agreement
- Virtualenv
- If the project specifies
- Install via apt:
sudo apt install python3-venv
- Note: when both conda and virtualenv are installed, make sure the correct environment is activated (they seem the same from the terminal)
Containers
- Docker: TODO
Quick Fix
CMake update
Update latest CMake on Ubuntu (generated by Claude):
| |
Compiler
Install latest standard library: sudo apt install libstdc++-12-dev
Git Clone
One-liner to use SSH url: sed -i 's/https:\/\/github.com\//git@github.com:/' .gitmodules
Recursive script:
# Function to update .gitmodules and sync
# Function to process each level
# 5. Repeat multiple times to ensure all nested levels are processed
for; do
done
Huggingface
HF mirror: export HF_ENDPOINT=https://hf-mirror.com
Mindscope: https://www.modelscope.cn/home