The Raspberry Pi 3B may be modest in specs — just 1GB RAM and a 4-core ARM CPU — but with a minimal Lite OS and a headless setup, it becomes a lean and efficient coding machine.
In this guide, we’ll cover everything from first boot to benchmarking and creating portable backups of your custom setup. Ideal for devs, tinkerers, and minimalist hackers!
🧰 What You’ll Need
- Raspberry Pi 3B
- microSD card (8GB+ recommended)
- Raspberry Pi OS Lite (no desktop)
- SSH access (headless setup)
- Wi-Fi or Ethernet
🛰️ Step 1: Headless Setup of Raspberry Pi OS Lite
📁 1. Prepare the SD Card
Download Raspberry Pi OS Lite and flash using:
- Raspberry Pi Imager
- balenaEtcher
-
dd
(for advanced users)
⚙️ 2. Enable SSH and Wi-Fi
Place these two files in the /boot
partition of the SD card:
-
ssh
(empty file) -
wpa_supplicant.conf
(for Wi-Fi):
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="Your_SSID"
psk="Your_PASSWORD"
}
🔌 3. Boot and Connect via SSH
Insert the SD card, power up the Pi, and connect:
ssh pi@raspberrypi.local
# or use the IP
ssh pi@<ip-address>
🔒 Step 2: Initial Setup & Security
Once logged in:
passwd # Change default password
sudo apt update && sudo apt upgrade -y
sudo raspi-config
In raspi-config
, set:
- Locale
- Timezone
- Hostname
- Enable interfaces (SSH, I2C, etc.)
🛠️ Step 3: Essential Package Installation
Install tools for development, monitoring, and coding:
sudo apt install -y \
git curl wget build-essential \
python3 python3-pip python3-venv \
vim nano tmux htop neofetch \
nodejs npm
Python setup:
python3 -m pip install --upgrade pip
python3 -m pip install virtualenv ipython
📊 Step 4: Benchmark Your Raspberry Pi
Install benchmark tools:
sudo apt install -y sysbench stress hdparm
🧠 CPU Benchmark
sysbench cpu --threads=4 --cpu-max-prime=20000 run
💾 Memory Benchmark
sysbench memory run
📀 Disk Benchmark
sudo hdparm -Tt /dev/mmcblk0
dd if=/dev/zero of=testfile bs=10M count=100 conv=fsync
rm testfile
🌡️ Monitor Temps
vcgencmd measure_temp
watch -n 1 vcgencmd measure_temp
💾 Step 5: Back Up Your Setup
📂 Create Backup Directory
mkdir -p ~/pi-backup/etc-backup
🗃️ Copy Dotfiles and Configs
cp ~/.bashrc ~/pi-backup/
cp -r ~/.config ~/pi-backup/
🧷 Save Package List
apt-mark showmanual > ~/pi-backup/manual-packages.txt
📁 Copy System Configs
sudo cp -r /etc ~/pi-backup/etc-backup/
📦 Optional: Compress Backup
cd ~
tar -czvf pi-backup.tar.gz pi-backup
To extract later:
tar -xzvf pi-backup.tar.gz
♻️ Step 6: Restore on a New Pi
✅ Copy pi-backup
folder to new Pi
🔁 Run Restore Script
#!/bin/bash
echo "Restoring packages..."
xargs sudo apt install -y < ~/pi-backup/manual-packages.txt
echo "Restoring configs..."
cp ~/pi-backup/.bashrc ~/
cp -r ~/pi-backup/.config ~/
Make executable:
chmod +x restore.sh
./restore.sh
🚀 Bonus Tips
- Use VS Code Remote SSH to edit code from your main computer
- Use
tmux
orscreen
to keep sessions alive - Use
git
to manage and sync your dotfiles
🧠 Conclusion
With just a few tools and best practices, your headless Raspberry Pi 3B becomes a powerful coding box — light on resources, but heavy on possibilities.
Whether you're into Python dev, automation, or server-side scripting, this guide gives you a solid base to build from — and repeat any time.
Top comments (0)