Raspberry Pi — SBC

First Boot & System Updates

After successfully connecting to your Pi via SSH, run these essential setup steps to update the system and configure it for development.


Step 1 — Update the Package List and Upgrade

Always run updates immediately after a fresh OS install:

shell
sudo apt update
sudo apt upgrade -y

This may take 5–10 minutes on first run as it downloads all pending security patches and package updates.


Step 2 — Install Essential Development Tools

shell
sudo apt install -y \
  git \
  python3 \
  python3-pip \
  python3-venv \
  python3-dev \
  build-essential \
  cmake \
  ninja-build \
  curl \
  wget \
  vim \
  htop \
  tree \
  unzip \
  i2c-tools \
  pigpio

Step 3 — Configure Hostname

If you want to change your Pi's hostname:

shell
sudo hostnamectl set-hostname analog-pi

Edit the hosts file to match:

shell
sudo nano /etc/hosts
# Change: 127.0.1.1 raspberrypi
# To:     127.0.1.1 analog-pi

Step 4 — Enable Important Interfaces

Use the raspi-config tool to enable I2C, SPI, and the camera:

shell
sudo raspi-config

Navigate to:

  • Interface Options → I2C → Enable
  • Interface Options → SPI → Enable
  • Interface Options → Camera → Enable (Pi 4 with Camera Module)
  • Interface Options → SSH (verify it's enabled)

Select Finish and Reboot when prompted.

After reboot, reconnect via SSH and verify I2C is enabled:

shell
ls /dev/i2c-*
# Expected: /dev/i2c-1

Step 5 — Set Timezone and Locale

shell
# Set timezone (example: Asia/Kolkata for IST)
sudo timedatectl set-timezone Asia/Kolkata

# Verify
timedatectl

Step 6 — Configure Python Environment

On Raspberry Pi OS (Bookworm+), system Python is managed and pip install without a virtual environment may be blocked. Create a virtual environment for your projects:

shell
# Create a project virtual environment
python3 -m venv ~/workshop_env

# Activate it
source ~/workshop_env/bin/activate

# Now install packages freely
pip install numpy opencv-python-headless pillow requests

To activate this environment automatically when you log in:

shell
echo "source ~/workshop_env/bin/activate" >> ~/.bashrc

Step 7 — Test GPIO Access

shell
# Install the RPi.GPIO library
pip install RPi.GPIO

# Quick GPIO test (Python)
python3 - << 'EOF'
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
GPIO.output(18, GPIO.HIGH)
import time
time.sleep(1)
GPIO.output(18, GPIO.LOW)
GPIO.cleanup()
print("GPIO test passed!")
EOF

Step 8 — Set Up Automatic Security Updates (Optional)

shell
sudo apt install -y unattended-upgrades
sudo dpkg-reconfigure --priority=low unattended-upgrades

Essential Commands Reference

Once your Pi is set up, here are the commands you'll use most often:

shell
# System
sudo reboot                     # Reboot the Pi
sudo shutdown -h now            # Safely power off
df -h                           # Check disk space
free -h                         # Check memory usage
vcgencmd measure_temp           # CPU temperature (Pi 4/5)
htop                            # Live system resource monitor

# Network
ip addr                         # Show IP addresses
nmcli device wifi list          # List available Wi-Fi networks
nmcli device wifi connect "SSID" password "PASSWORD"  # Connect to Wi-Fi

# GPIO & Peripherals
i2cdetect -y 1                  # Scan I2C bus for connected devices
ls /dev/ttyAMA* /dev/ttyUSB*    # List serial ports
raspi-config                    # System configuration tool

# Package management
sudo apt update                 # Update package list
sudo apt upgrade                # Upgrade installed packages
sudo apt install <package>      # Install a package
sudo apt remove <package>       # Remove a package

For a full IDE experience on your Pi:

  1. Install the Remote - SSH extension in VS Code
  2. Press F1Remote-SSH: Connect to Host
  3. Enter analog@analog-pi.local
  4. Open the /home/analog/ folder in VS Code
  5. Use the integrated terminal to run commands on the Pi

🎉 Your Raspberry Pi is Ready!

You now have a fully updated, configured Raspberry Pi ready for:

  • Python development
  • GPIO and sensor experiments
  • Edge AI inference
  • Computer vision with OpenCV
  • Linux-based IoT projects

Next Steps

Previous
Headless SSH Setup