Unit

Install Raspbian on a Raspberry Pi

Learn how to choose, configure, write, boot, and verify Raspbian, now called Raspberry Pi OS, on a Raspberry Pi.

Raspbian is the historical name for a Debian-based operating system designed for Raspberry Pi boards. The official name used by current Raspberry Pi images and tools is Raspberry Pi OS. If your course materials say Raspbian while Raspberry Pi Imager says Raspberry Pi OS, the installation process is broadly the same.

This lesson covers a desktop installation and a headless installation. Headless operation means running the Pi without a directly attached monitor, keyboard, or mouse and managing it remotely, usually with SSH.

Installation requirements

ItemRequired or optionalPurposeNotes
Raspberry Pi boardRequiredComputer on which Raspberry Pi OS will runUse an image compatible with the board model.
Suitable power supplyRequiredProvides stable power during boot and operationUse a supply appropriate for your Pi model and connector.
microSD cardRequiredStores the boot files, operating system, and user filesChoose sufficient capacity and an appropriate speed rating. A faster, reliable card improves installation and general use.
microSD card reader or adapterRequiredConnects the card to another computer for imagingA USB reader is commonly used.
Display and HDMI cable or adapterOptionalShows the graphical desktop or boot messagesNeeded for a normal local desktop setup.
Keyboard and mouseOptionalProvides local inputNeeded for interactive desktop setup unless settings are preconfigured.
Ethernet cableOptionalProvides wired network accessUseful for reliable first boot and troubleshooting.
Wi-Fi credentialsOptionalConnects the Pi to a wireless networkHave the SSID, which is the visible Wi-Fi network name, and password ready.
SSH clientOptionalProvides remote command-line accessRequired for a typical headless workflow.

Choose an operating system edition

A disk image is a file containing a complete copy of an operating system's filesystem and boot data. Raspberry Pi Imager writes this image to the microSD card in a bootable form.

EditionInterfaceBest forAdvantagesConsiderations
DesktopGraphical desktopBeginners, education, and local applicationsIncludes windows, menus, desktop tools, and commonly used software.Uses more storage and memory; normally used with a display, keyboard, and mouse.
LiteCommand lineHeadless systems, servers, and automationSmaller installation, fewer background services, and efficient resource use.Requires command-line administration and remote access or locally attached input.
64-bitDesktop or command lineCompatible Pi models and software needing a 64-bit environmentSupports 64-bit applications and can make better use of larger memory configurations.Some older software or hardware instructions may have better compatibility with 32-bit images.
32-bitDesktop or command lineOlder models or software with 32-bit requirementsBroad compatibility with many older programs and configurations.Has limits compared with a 64-bit environment and may not be ideal for software requiring 64-bit support.

Choose the edition by considering the Pi model, available memory, software compatibility, storage capacity, and whether you want a graphical boot experience. For a beginner using a monitor, the standard desktop edition is usually the simplest choice. For a home server, automation project, or remote system, Lite is often more appropriate.

Prepare the microSD card safely

  1. Back up any files on the card that you need. Writing an image erases all existing data on the selected storage device.
  2. Insert the microSD card into its reader or adapter and connect it to the computer that will run the imaging tool.
  3. Identify the card carefully by its removable-device name and capacity. Do not select the computer's internal disk or another external drive.
  4. Do not manually format the card unless a specific recovery procedure requires it. An imaging utility normally creates or replaces the required partitions and filesystems.
  5. After writing and verification finish, safely eject the card from the operating system before removing it from the reader.

Use Raspberry Pi Imager

Raspberry Pi Imager is the official graphical utility for selecting, configuring, and writing Raspberry Pi OS images. An equivalent supported image-writing tool can also be used, but its controls may be arranged differently.

  1. Install and launch Raspberry Pi Imager on the other computer.
  2. Select the Raspberry Pi model if the tool asks for it.
  3. Choose the intended Raspberry Pi OS image. Select a desktop or Lite edition and choose 64-bit or 32-bit according to your plan.
  4. Select the correct removable microSD storage device. Recheck its name and capacity before continuing.
  5. Open the image customization or advanced settings area before writing if you want to configure first-boot options.
  6. Start the write operation and wait. The tool first writes the image and then verifies the result.
  7. Wait for both writing and verification to finish before ejecting the card.

Verification reads back data from the card and checks it against the intended image. It can reveal a bad card, unreliable reader, poor adapter, interrupted transfer, or corrupted write before you try to boot the Pi.

Configure first-boot settings before writing

Preconfiguration is especially useful for a headless installation because it avoids requiring a display and keyboard during the first boot. In Raspberry Pi Imager, configure the fields that apply to your setup:

  • Hostname: the network name used to identify the Pi.
  • Username and password: create a non-default username and a strong, unique password. Do not assume that a default account will be available.
  • Wi-Fi: enter the SSID, Wi-Fi password, and correct Wi-Fi country. The country setting helps the system use permitted wireless channels.
  • Locale: select the language and regional conventions, including date formats where applicable.
  • Keyboard layout: choose the layout that matches the physical keyboard.
  • Time zone: select the region used for system time and scheduled tasks.
  • SSH: enable it when you need remote command-line access. Use password or key-based authentication according to the options provided by the tool.

Save the settings before starting the write. If you change them after the image has already been written, repeat the write or configure the system during local first-run setup.

Boot the Raspberry Pi for the first time

  1. Make sure the Raspberry Pi is powered off.
  2. Insert the prepared microSD card into the Pi's microSD slot.
  3. Connect the display and HDMI cable or adapter, if using a desktop setup.
  4. Connect the keyboard and mouse, if local input is needed.
  5. Connect Ethernet or prepare to use the configured Wi-Fi network.
  6. Connect the appropriate power supply last. Applying power starts the boot process.
  7. Allow extra time for the first startup. The system may expand its filesystem or perform first-run setup.

With a desktop image, you should eventually see the graphical desktop or a first-run configuration screen. With a Lite image, expect a text login prompt. Complete any remaining configuration, create or confirm the user account, and follow the displayed setup steps.

Confirm a successful installation

A successful installation should reach either the desktop or a command-line login prompt. Check the following:

  • The system responds to keyboard input.
  • The display shows a usable desktop or boot and login text.
  • The system recognizes the expected storage capacity.
  • Ethernet or Wi-Fi connects when networking is part of the setup.
  • Internet access works if the network is expected to provide it.

Run these commands from a terminal or SSH session:

cat /etc/os-release
hostname
ping -c 4 raspberrypi.com

The first command displays operating system release information. The second prints the configured hostname. The ping command tests basic reachability; a successful result does not prove that every web service works, but it is a useful first network check.

To confirm the Raspberry Pi model, use the desktop's system information tools or an appropriate hardware-information command available on your installed image. The model matters when selecting future images, accessories, and power supplies.

Perform initial system maintenance

After the first successful boot, update the package index and install available package updates. APT is the Debian-family command-line package management tool, and a package manager installs, updates, and removes software packages.

sudo apt update
sudo apt full-upgrade
sudo reboot

sudo apt update downloads current package information. sudo apt full-upgrade installs available updates and handles dependencies. Reboot when requested or when kernel, firmware, or other system components require it. Updates provide security fixes, bug fixes, and newer software versions.

For related Linux command-line practice, see Essential Linux Commands and APT-GET Command.

Headless installation workflow

In a headless installation, configure the hostname, username, password, Wi-Fi details, Wi-Fi country, locale, keyboard layout, time zone, and SSH in the imager before writing the card.

  1. Write and verify the configured image.
  2. Insert the card into the powered-off Pi.
  3. Connect power and, if needed, Ethernet. With correct Wi-Fi settings, the Pi can join the wireless network during startup.
  4. Find the Pi on the local network by its hostname or by checking the router's address list. Local hostname resolution depends on the client computer and network.
  5. From another computer, connect with SSH:
ssh <username>@<hostname>.local

Replace the placeholders with the username and hostname configured during imaging. On the first connection, SSH may show the server's host key. Accept it only after verifying that you are connecting to the intended Pi; this key helps SSH detect a changed or unexpected host later.

MethodMonitor and keyboard neededNetwork setup timingRemote accessTypical use case
Local desktopYes, normallyDuring or after first bootOptionalBeginner setup and graphical applications
Preconfigured desktopNot required for first bootBefore writing, in the imagerOptional SSHDesktop installation where peripherals are temporarily unavailable
Lite headlessNoBefore writing, in the imagerSSH requiredServers, automation, and remote administration
Local LiteYes, for local loginDuring or after first bootOptionalSmall command-line systems with local access

Troubleshoot common problems

The Raspberry Pi does not boot

  • Re-image the card and allow verification to complete.
  • Try a known-good microSD card.
  • Use a power supply appropriate for the Raspberry Pi model and check that it is stable.
  • Check the HDMI connection, adapter, cable, and selected monitor input.

Likely causes include an incomplete write, faulty or incompatible storage, insufficient power, or a display connection problem.

The imaging tool cannot see the microSD card

  • Remove and reconnect the card and reader.
  • Try a different USB port, reader, adapter, or computer.
  • Confirm that the computer detects the device in its storage-management utility.
  • Check that the card is fully inserted.

Wi-Fi does not connect on first boot

  • Recheck the SSID, password, and Wi-Fi country.
  • Move the Pi closer to the access point or use Ethernet temporarily.
  • Confirm that the imaging settings were saved before writing.
  • Re-image with corrected settings if necessary.

SSH connection fails

  • Confirm that SSH was enabled before writing the image.
  • Make sure the Pi and client computer are on the same network.
  • Check the hostname, IP address, username, and password.
  • Find the assigned address in the router and connect using the IP address if hostname resolution is unavailable.
  • Use the configured username rather than assuming a default account.

Writing or verification reports an error

  • Select or download the image again if the source may be corrupted.
  • Try another microSD card, reader, adapter, USB port, or cable.
  • Close applications using the removable drive and retry.
  • Check that the imaging tool has permission to access the storage device.

Make installations repeatable and safe

  • Back up user files before re-imaging an existing card.
  • Keep the downloaded image, or record the selected operating system edition and version, when you need to reproduce a lab or project.
  • Use a separate card or a backup image before major configuration changes and experiments.
  • After reinstalling, restore user files and reinstall required packages rather than assuming they remain on the new image.

For hardware context, read What Is Raspberry Pi. Networking concepts that help with hostname discovery and SSH include Computer Network Explained and Private IP Addresses.

Exam-relevant notes

  • Raspbian is the historical name; Raspberry Pi OS is the current official name.
  • A disk image is written or flashed to the microSD card; it is not merely copied as an ordinary file.
  • Writing an image erases the selected card, so device identification and backups are essential.
  • Desktop images suit local graphical use; Lite images suit command-line and headless systems.
  • Preconfiguring credentials, networking, locale, and SSH can eliminate the need for local peripherals on first boot.
  • Verification checks whether the written data can be read back correctly.
  • Run sudo apt update and sudo apt full-upgrade after the first successful boot.