Skip to content
Tutorials Center
My learning

Topics

Lesson 5 of 37 ยท Setup and OS

Raspberry Pi OS and the Imager

Choose a Raspberry Pi OS edition, write it to a microSD card with Raspberry Pi Imager, preconfigure Wi-Fi, SSH and a user, and verify the image.

The Raspberry Pi has no built-in storage and no operating system until you provide them. You install the system on a microSD card on another computer, put the card in the Pi and power it on. The official operating system is Raspberry Pi OS, a Linux distribution based on Debian and tuned for the Pi's hardware. It comes with Python, a code editor, a browser and the tools used throughout this course. This lesson shows how to choose an edition and write it with Raspberry Pi Imager.

Pick an edition

Raspberry Pi OS comes in three main flavors:

  • Raspberry Pi OS with desktop and recommended software. The full experience: graphical desktop, office tools, browser, programming tools. Largest download.
  • Raspberry Pi OS with desktop. The desktop and essentials without the extras.
  • Raspberry Pi OS Lite. No desktop at all, only a command line. Small, fast, ideal for servers and headless projects.

Each comes in a 64-bit and a 32-bit build. Choose 64-bit for the Pi 3, 4, 5 and Zero 2 W; 32-bit is for older or very small-memory boards. Other systems exist as well (Ubuntu, LibreELEC, RetroPie, Home Assistant OS), but Raspberry Pi OS is the best-supported start and every lesson in this course assumes it.

Choose your OS

Desktop Screen, mouse, browser
Lite Command line only
1 / 2

Writing the card with Imager

Raspberry Pi Imager is a free program for Windows, macOS and Linux from the Raspberry Pi website. The steps are the same everywhere:

  1. Insert the microSD card into your computer.
  2. Open Imager and choose your Raspberry Pi model.
  3. Choose the operating system, for example Raspberry Pi OS (64-bit).
  4. Choose the storage device. Double-check it is the card, because everything on it will be erased.
  5. Click Next and, when asked about customization, choose Edit Settings.
  6. Click Write and wait. Imager downloads, writes and verifies the image.

The customization settings

The important part is the settings screen. It lets you preconfigure the system so it is ready the first time it boots:

  • Hostname, for example pi5.local, so you can find the board by name.
  • Username and password. Newer images no longer ship with a default pi user, so you must create one here.
  • Wi-Fi network name, password and country. The country code matters: it controls which channels the radio may use.
  • Locale and time zone, and keyboard layout.
  • Enable SSH, with a password or with a public key, if you plan to work headless.

Imager stores these choices as small configuration files in the card's boot partition, and the Pi applies them on first start.

On a real computer these steps are graphical. The command-line equivalent for Linux or macOS is rpi-imager, or writing the image with a tool like dd, which is shown read-only below. Be extremely careful with dd: choosing the wrong device wipes your own disk.

Terminal
# read-only example on Linux; /dev/sdX is the card, check with lsblk first
lsblk
xzcat raspios.img.xz | sudo dd of=/dev/sdX bs=4M status=progress conv=fsync

Verify the download

Imager checks the image for you, but it helps to understand why: a corrupted download can cause weird crashes. A checksum is a short fingerprint of a file. If even one bit differs, the fingerprint changes completely. The stand-in below computes a SHA-256 fingerprint of some bytes, then shows how a single changed byte produces a totally different result.

Python Stand-in: checksum a fake image

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

On a real machine you would run sha256sum raspios.img.xz and compare with the value published next to the download.

What the card looks like afterwards

A freshly written card has two partitions: a small FAT32 boot partition and a larger Linux root partition (ext4). The boot partition is readable on Windows and macOS. It holds the firmware, the kernel and two text files you will use in raspi-config and Updates: config.txt for hardware settings and cmdline.txt for kernel options. The sketch below lists a typical layout with sizes.

Python Stand-in: card layout

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Common mistakes

  • Choosing the wrong drive. Imager asks you to pick the storage; read the size and name carefully.
  • Skipping the Wi-Fi country. Without it the radio may stay disabled.
  • Forgetting to create a user. There is no default login to fall back on.
  • Pulling the card early. Wait until Imager says it is done and has verified the write.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which edition has no graphical desktop and is ideal for servers?

    Lite boots to a command line, uses little memory and is the usual choice for headless servers.
  2. 2. Why should you set the Wi-Fi country in Imager?

    Regulations differ by country, so the Pi needs the country code to enable the Wi-Fi radio.
  3. 3. What is a checksum used for?

    A checksum fingerprint changes if any bit differs, so it reveals a damaged download.
  4. 4. Where do the hardware settings file config.txt live?

    config.txt sits on the boot partition, which you can edit even on Windows or macOS.

Summary

  • Raspberry Pi OS (Debian based) is the recommended system; Lite has no desktop.
  • Use 64-bit for modern boards.
  • Raspberry Pi Imager writes the card and can preconfigure hostname, user, Wi-Fi and SSH.
  • Verify the write and keep the card name straight so you do not erase the wrong disk.

Next: First Boot and Headless Setup