- Raspberry Pi 5, 8GB
- PSU for Raspberry Pi 5 (27W)
- Raspberry Pi Active Cooler*
- Pimoroni NVMe Base
- PCIe Pipe 50mm
- Crucial P3 Plus 1TB PCIe 3 NVMe SSD
- Pimoroni Pibow case
- Display (Pi-Top FHD Touch)
- Keyboard (Logitech K400)
* Argon THRML 60mm Radiator Cooler may possibly be better cooling solution than the official Active Cooler if using the Pi to generate image/video/audio embeddings.
-
Install the OS.
- Operating System: Raspberry Pi OS (Bookworm, 64-bit)
- Hostname:
bonbon
- Username:
pi
- Password:
let***n!**
-
Configure the Raspberry Pi to boot from the NVMe SSD.
Source: https://docs.docker.com/engine/install/debian/
-
Add Docker's GPG key.
sudo apt update sudo apt install ca-certificates curl # If keyrings isn't already installed. #sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc
-
Add Docker's repository to
apt
sources.echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
-
Update the
apt
list.sudo apt update
-
Install Docker.
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
To install a specific version:
-
List the available versions.
apt-cache madison docker-ce | awk '{ print $3 }' 5:25.0.0-1~debian.12~bookworm 5:24.0.7-1~debian.12~bookworm ...
-
Select the desired version and install.
VERSION_STRING=5:25.0.0-1~debian.12~bookworm sudo apt-get install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-buildx-plugin docker-compose-plugin
-
-
Verify that the installation is successful by running the example
hello-world
image.sudo docker run --rm hello-world
The output will look like this:
Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (arm64v8) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
-
Add the Raspberry Pi user to
docker
group so that Docker command can be run withoutsudo
.sudo usermod -a pi -G docker
This will come into effect on next reboot, but for now, add the user to the new group manually:
newgrp docker
Docker persists build cache, containers, images, and volumes to disk, and over time, these artifacts can build up and take up a lot of space on a system.
Task | Command |
---|---|
View disk usage. | docker system df |
List all running containers | docker container ls |
List all containers, both running and | docker container ls -a |
List unused containers. | docker container ls -f status=exited -f status=dead |
List all images | docker image ls |
List all images including intermediate images | docker image ls -a |
List danging images | docker image ls -f dangling=true |
Remove all stopped containers. | docker container prune |
Remove dangling images. | docker image prune |
Remove anonymous volumes. | docker volume prune |
Remove build cache. | docker buildx prune |
Remove unused networks. | docker network prune |
Remove all unused containers, networks, images (dangling) and build cache (unused). | docker system prune |
docker image prune -a |
|
docker volume prune -a |
|
docker system prune -a |
|
docker system prune -a --volumes |
Use the -f
or --force
option with prune
to mute the prompts for confirmation e.g. docker image prune -f
See: https://docs.docker.com/reference/cli/docker/
Source: https://www.jeffgeerling.com/blog/2021/htgwa-create-samba-smb-share-on-raspberry-pi
-
Install Samba.
sudo apt install samba samba-common-bin
-
Create the directory to share.
mkdir /home/pi/Projects
-
Configure samba share.
sudo nano /etc/samba/smb.conf
At the bottom of the file, add the following lines:
[pi-share] path=/home/pi/Projects writable=yes create mask=0775 directory mask=0775 public=no
-
Restart Samba.
sudo systemctl restart smbd
-
Create a user and password for Samba access.
sudo smbpasswd -a pi # e.g. raspberry
-
Connect to the share.
Find the IP address or host name of your Raspberry Pi.
hostname -I # Output: 192.168.1.173 172.17.0.1 hostname # Output: bonbon
Use the first IP address i.e.
192.168.1.173
to connect to the samba share.
-
To disable, press the Ctrl+Alt+F1 keys to enter console mode, and then run the command:
sudo systemctl isolate multi-user.target
-
To enable, run the following command, and then press the Ctrl+Alt+F1 keys to switch to Desktop.
sudo systemctl isolate graphical.target
-
To disable, press the Ctrl+Alt+F1 keys to enter console mode, and then run the commands:
sudo systemctl set-default multi-user.target sudo reboot
-
To enable, run the commands:
sudo systemctl set-default graphical.target sudo reboot
Disabling, enabling and modifying Raspberry Pi's default swap on the boot microSD Card or SSD.
-
Check if the swapfile service is enabled.
systemctl is-enabled dphys-swapfile
If the output is
disabled
, enable it with the command:sudo systemctl enable dphys-swapfile
-
Check if the swapfile service is active/running.
systemctl is-active dphys-swapfile
If the output is
inactive
, start it with the command:sudo systemctl start dphys-swapfile
-
Turn the swap off.
sudo dphys-swapfile swapoff
-
Open and edit the configuration file.
sudo nano /etc/dphys-swapfile
Search for the following line in the file (e.g. use the Ctrl+W shortcut to search in-file) and edit the swap size. The size must given in megabytes, and the specified size must be available on the boot microSD card/SSD.
CONF_SWAPSIZE=100
e.g. increase the swapsize to 1GB:
CONF_SWAPSIZE=1024
e.g. increase the swapsize to 2GB:
CONF_SWAPSIZE=2048
-
Reinitialize the swap file.
sudo dphys-swapfile setup
The command will delete the original/previous swap file and recreate it with the new size.
-
Turn the swap on.
sudo dphys-swapfile swapon
-
Reboot.
sudo reboot
-
Verify.
free -h total used free shared buff/cache available Mem: 7.9Gi 642Mi 6.5Gi 45Mi 866Mi 7.2Gi Swap: 2.0Gi 0B 2.0Gi
-
Turn the swap off.
sudo dphys-swapfile swapoff
-
Uninstall the swap file.
sudo dphys-swapfile uninstall
-
Stop the swap file service.
sudo systemctl stop dphys-swapfile
-
Disable the swap file service.
sudo systemctl disable dphys-swapfile
-
Reboot.
sudo reboot
Source:
-
Generate a new GitHub SSH key.
ssh-keygen -t ed25519 -C "[email protected]"
-
Add SSH key to the ssh-agent.
-
Start the ssh-agent in the background.
eval "$(ssh-agent -s)"
-
Add SSH private key to the ssh-agent.
ssh-add ~/.ssh/id_github
-
-
Add the public key to GitHub.
cat ~/.ssh/id_github.pub # Then select and copy the contents of the id_github.pub file # displayed in the terminal as a new SSH key at https://github.com/settings/keys
-
Authenticate and verify access.
ssh -T [email protected]
Source: https://github.com/pyenv/pyenv
-
Install build dependencies.
sudo apt update; sudo apt install build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev llvm
See: https://github.com/pyenv/pyenv/wiki#suggested-build-environment
-
Install Pyenv.
curl https://pyenv.run | bash
-
Set up shell environment for Pyenv.
Add the following to
~/.bashrc
:export PYENV_ROOT="$HOME/.pyenv" command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init -)"
If there is
~/.bash_profile
, add the following to it:export PYENV_ROOT="$HOME/.pyenv" [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init -)"
Otherwise, add the following to
~/.profile
:export PYENV_ROOT="$HOME/.pyenv" command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init -)"
-
Reload ~/.bashrc settings.
source ~/.bashrc
Source: https://code.visualstudio.com/docs/setup/linux
-
Download the .deb package from https://code.visualstudio.com/download.
wget https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64
-
Install.
sudo apt install code_1.90.2-1718751586_amd64.deb
Installing the .deb package will automatically install the apt repository and signing key to enable auto-updating using the system's package manager.
Source: https://vscodium.com/
-
Add VSCodium's GPG key.
wget -qO - https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg | gpg --dearmor | sudo dd of=/usr/share/keyrings/vscodium-archive-keyring.gpg
-
Add VSCodium's repository to
apt
sources.echo 'deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.gpg ] https://download.vscodium.com/debs vscodium main' | sudo tee /etc/apt/sources.list.d/vscodium.list
-
Update the
apt
list.sudo apt update
-
Install VSCodium.
sudo apt install codium
This involves accessing files on Raspberry Pi from another/remote computer that is on the same network as your Raspberry Pi via Visual Studio Code/VSCodium and SSH.
- In Visual Studio Code/VSCodium on your remote computer, open the Command Palette, using Shift + Command + P (Mac) / Ctrl + Shift + P (Windows/Linux).
- Search for Remote-SSH: Connect to Host...
- Enter your username and hostname for your Raspberry Pi e.g.
[email protected]
. - When prompted, enter your password for your user account on your Raspberry Pi.
- Select the directory to open.
Source: https://code.visualstudio.com/docs/datascience/jupyter-kernel-management#_existing-jupyter-server
-
On your Raspberry Pi, start Jupyter Notebook or Jupyter Lab, either on the Pi or in Docker container.
-
On another computer that is on the same network as your Raspberry Pi, open a new or existing notebook in VSCodium or Visual Studio Code.
-
Click the Select Kernel button (top right hand of VSCodium/Visual Sudio Code window), and select Existing Jupyter Server (the options will appear in the address bar).
-
Enter the URL of your Jupyter Notebook or Jupyter Lab running on the Raspberry Pi.
-
Enter the password or token for your Jupyter Notebook or Jupyter Lab.
-
For Change server display name, accept the given name or delete it.
-
Select Python 3 (ipykernel).
-
Verify by putting the following in a cell and running the cell.
import os os.listdir()
This should output a list of directories on Raspberry Pi e.g. in Docker container:
['sbin', 'media', 'lib', 'opt', 'etc', 'sys', 'usr', 'home', 'run', 'tmp', 'boot', 'srv', 'root', 'dev', 'bin', 'var', 'proc', 'mnt', 'app', '.dockerenv']