Skip to content

Initial Setup Guide for Raspberry Pi

This guide walks you through the process of installing an operating system on your Raspberry Pi and completing essential first-time setup tasks. Whether you're using your Pi with a monitor (standard setup) or without one (headless setup), these instructions will help you get started.

Choosing an Operating System

Raspberry Pi supports several operating systems, each with different strengths:

OS Description Best For
Raspberry Pi OS (64-bit) Official OS with 64-bit architecture Modern Pi models (3/4/5/Zero 2), best performance and Docker support
Raspberry Pi OS (32-bit) Official OS for legacy 32-bit CPUs Older models (Pi 1/2/Zero) or memory-constrained setups
Raspberry Pi OS Lite Minimal version without desktop Headless servers, IoT, and resource-constrained setups (CLI only)
Ubuntu Server Enterprise-grade server OS Containerized workloads, Docker, and developer environments
RetroPie Gaming and emulation platform Retro gaming consoles
LibreELEC Media center focused Home theater systems

For beginners, Raspberry Pi OS (64-bit) is highly recommended if you are using a Raspberry Pi 3, 4, 5, or Zero 2 W. It offers the best performance, modern software compatibility, and full support for containers. Use the 32-bit version only if you are using older hardware (like the original Raspberry Pi 1, 2, or Zero/Zero W).

Installing the Operating System

The Raspberry Pi Imager is the easiest way to install an operating system on your microSD card.

  1. Download Raspberry Pi Imager

    • Visit the official website
    • Download and install the appropriate version for your computer
  2. Install Raspberry Pi Imager

    • On Windows/Mac: Run the installer
    • On Linux (Debian/Ubuntu):
      sudo apt install rpi-imager
      
  3. Write the OS to SD Card

    • Insert your microSD card into your computer
    • Launch Raspberry Pi Imager
    • Click "Choose OS" and select your preferred Raspberry Pi OS version
    • Click "Choose Storage" and select your microSD card
    • Click the gear icon (⚙️) to access advanced options:
      • Set hostname (e.g., raspberrypi)
      • Enable SSH (for headless setup)
      • Configure Wi-Fi (for headless setup)
      • Set username and password
      • Configure locale settings
    • Click "Write" and wait for the process to complete
    • Remove the SD card when prompted

Method 2: Manual Image Download and Installation

If you prefer to download the OS image directly:

  1. Download OS Image

  2. Write Image to SD Card

    • On Windows: Use Win32 Disk Imager or balenaEtcher
    • On macOS: Use balenaEtcher or dd command in Terminal
    • On Linux: Use balenaEtcher or dd command:
      1
      2
      3
      # Replace sdX with your SD card device (e.g., sdb)
      # BE VERY CAREFUL with this command, as selecting the wrong device can erase your hard drive
      sudo dd bs=4M if=path/to/image.img of=/dev/sdX status=progress conv=fsync
      
  3. Configure for Headless Setup (Optional)

    [!WARNING] Starting with Raspberry Pi OS Bookworm (Debian 12), the network backend has transitioned from dhcpcd to NetworkManager. Consequently, placing a wpa_supplicant.conf file in the boot partition is no longer supported on modern releases.

    We highly recommend using Method 1 (Raspberry Pi Imager) to pre-configure Wi-Fi and SSH via its OS Customisation settings. If you must set it up manually on a flashed card:

    • Enable SSH: Create an empty file named ssh (or ssh.txt) in the boot partition.
    • Configure Wi-Fi via NetworkManager: Create a file named system-connections/preconfigured.nmconnection in the boot partition (often mounted as /boot/firmware/ on Bookworm) and configure it as follows:
      [connection]
      id=Preconfigured-WiFi
      type=wifi
      
      [wifi]
      mode=infrastructure
      ssid=YOUR_WIFI_NAME
      
      [wifi-security]
      auth-alg=open
      key-mgmt=wpa-psk
      psk=YOUR_WIFI_PASSWORD
      
      [ipv4]
      method=auto
      
      [ipv6]
      method=auto
      

First Boot Setup

Standard Setup (With Monitor)

  1. Insert the SD card into your Raspberry Pi
  2. Connect peripherals: HDMI display, keyboard, mouse, and power
  3. Power on your Raspberry Pi
  4. Complete the Welcome Wizard:
    • Set country, language, and timezone
    • Create a user account (or use the default 'pi' user if pre-configured)
    • Configure Wi-Fi if not already set
    • Update software when prompted

Headless Setup (Without Monitor)

  1. Insert the SD card into your Raspberry Pi
  2. Connect network: Either Ethernet cable or pre-configured Wi-Fi
  3. Power on your Raspberry Pi
  4. Find your Pi's IP address using one of these methods:

    • Check your router's connected devices list
    • Use a network scanner like nmap:
      sudo nmap -sn 192.168.1.0/24  # Adjust to your network range
      
    • Use multicast DNS (if supported): ping raspberrypi.local
  5. Connect via SSH:

    • On Windows: Use PuTTY or Windows Terminal
    • On macOS/Linux: Use Terminal
      1
      2
      3
      ssh username@raspberrypi.local  # If using mDNS
      # OR
      ssh username@192.168.1.X  # Replace with your Pi's IP address
      
    • Default credentials (if not customized):
      • Username: pi
      • Password: raspberry

System Updates and Package Installation

Always update your system after the first boot:

1
2
3
4
5
6
# Update package list and upgrade system
sudo apt update
sudo apt upgrade -y

# Install commonly used packages (customize as needed)
sudo apt install -y git python3-pip vim htop neofetch

Post-Installation Configuration

Essential Security Settings

  1. Change Default Password (if you haven't already):

    passwd
    
  2. Enable SSH (if not already enabled):

    sudo raspi-config
    # Navigate to Interface Options > SSH > Enable
    
  3. Configure Firewall:

    1
    2
    3
    sudo apt install ufw
    sudo ufw allow ssh
    sudo ufw enable
    
  4. Update System Firmware (Only if necessary):

    [!CAUTION] Do NOT use sudo rpi-update for routine updates. This tool installs bleeding-edge, experimental pre-release kernels and firmware that can make your system unstable or unbootable.

    For stable and safe firmware updates, always use the standard package manager:

    1
    2
    3
    sudo apt update
    sudo apt install --only-upgrade raspberrypi-kernel raspberrypi-bootloader
    sudo reboot
    

System Optimization

  1. Configure Memory Split (for desktop vs. GPU):

    1
    2
    3
    4
    5
    sudo raspi-config
    # Navigate to Performance Options > GPU Memory
    # For headless servers: 16MB
    # For desktop use: 128MB or higher
    # For gaming/media: 256MB or higher
    
  2. Enable Hardware Acceleration (for media playback):

    sudo raspi-config
    # Navigate to Advanced Options > GL Driver > GL (Fake KMS)
    
  3. Overclocking (optional, for advanced users):

    sudo raspi-config
    # Navigate to Performance Options > Overclock
    
    Warning: Overclocking may reduce the lifespan of your Pi and requires adequate cooling.

Configure Display and Locale Settings

1
2
3
4
5
6
sudo raspi-config
# Navigate to Localisation Options to set:
# - Locale
# - Timezone
# - Keyboard layout
# - WLAN Country (important for Wi-Fi compliance)

Enable Additional Interfaces

Enable hardware interfaces you plan to use:

1
2
3
4
5
6
7
sudo raspi-config
# Navigate to Interface Options to enable:
# - Camera
# - SPI
# - I2C
# - 1-Wire
# - Remote GPIO

Desktop Environment Customization

If you're using Raspberry Pi OS with desktop:

  1. Change Theme:

    • Right-click on desktop > Appearance Settings
  2. Configure Panels and Menus:

    • Right-click on panel > Panel Settings
  3. Install Additional Software:

    1
    2
    3
    4
    5
    6
    7
    8
    # For common programming tools
    sudo apt install -y build-essential python3-dev
    
    # For media playback
    sudo apt install -y vlc
    
    # For office applications
    sudo apt install -y libreoffice
    

Backup Your Configuration

Once you've completed your setup, consider backing up your SD card:

# On another Linux machine:
sudo dd bs=4M if=/dev/sdX of=~/raspberry_pi_backup.img status=progress

Or use tools like PiShrink to create compressed backups.

Troubleshooting First Boot Issues

No Display Output

  • Check HDMI connection
  • Try a different HDMI cable
  • Edit config.txt on the SD card (from another computer) and add:
    hdmi_force_hotplug=1
    hdmi_drive=2
    

Cannot Connect via SSH

  • Verify SSH is enabled
  • Check network connection
  • Ensure firewall allows SSH connections
  • Confirm correct IP address or hostname

Wi-Fi Not Connecting

  • Verify correct SSID and password in wpa_supplicant.conf
  • Check country code setting
  • Try connecting to 2.4GHz instead of 5GHz network (better range and compatibility)

Boot Process Hangs

  • Use a high-quality power supply (official recommended)
  • Check for SD card corruption
  • Try a fresh OS installation

Next Steps

After completing the initial setup, you might want to:

Welcome to the Raspberry Pi community! With your device now set up, you're ready to explore the exciting possibilities of this versatile computing platform.