Skip to content

Installing Raspberry Pi OS

This guide walks through installing Raspberry Pi OS on an SD card, booting a Raspberry Pi for the first time, and performing some basic configuration.

For the initial installation, we will use the official Raspberry Pi Imager.

Before getting started, you will need:

  • A Raspberry Pi
  • An SD card
  • A device (e.g. laptop, desktop, another pi) with:
    • Raspberry Pi Imager installed
    • An SD card slot, adapter, or reader
  • A monitor and appropriate display cable
  • A keyboard and mouse
  • A power cable (or another appropriate power source, such as PoE)
  • (If using a wired connection) Ethernet cable

Insert the SD card into the computer running Raspberry Pi Imager and open Raspberry Pi Imager.

  1. Choose your Raspberry Pi

    Select the model of Raspberry Pi you are installing the operating system on.

    For example: Raspberry Pi 4

    Select your Raspberry Pi device
  2. Choose the operating system

    Choose the operating system you want to install on your Raspberry Pi.

    For example: Raspberry Pi OS (64-bit)

    Choose operating system
  3. Choose your storage

    Select the SD card you inserted.

    Select your storage device
  4. Customization: Set Hostname

    Enter the hostname for your Raspberry Pi.

    Set hostname
  5. Customization: Set Localization

    Configure the localization settings for your Raspberry Pi.

    Set localization
  6. Customization: Set Username & Password

    Enter the username and password for your Raspberry Pi.

    Set username and password
  7. Customization: Wifi, SSH, and Raspberry Pi Connect

    Configure the Wifi, SSH, and Raspberry Pi Connect settings for your Raspberry Pi as needed. For the purposes of this guide, you can leave them at their default settings.

  8. Write the operating system to the SD card

    Once you have configured all the necessary settings, click Write to write the operating system to the SD card. Confirm that you want to proceed when prompted. You may also be prompted to input your password. Then, wait for the writing process to complete.

    Write operating system to SD card Confirm writing operating system to SD card
  9. Write complete!

    Select Finish when the write is complete. You have successfully written the operating system to the SD card. You can now remove the SD card from your computer and insert it into your Raspberry Pi to boot it up.

    Completed writing operating system to SD card

Once Raspberry Pi Imager has finished:

  1. Remove the SD card from your computer.
  2. Insert it into the Raspberry Pi.
  3. Connect your monitor, keyboard, mouse, network connection, and any other necessary peripherals.
  4. Connect power to the Raspberry Pi.

Wait for Raspberry Pi OS to finish booting.

Once it has booted, open the Terminal.

You should see a command prompt similar to:

username@hostname

After the Raspberry Pi has booted, update its package information and installed packages:

Terminal window
sudo apt update
sudo apt upgrade -y

If the system time is incorrect or is not synchronizing, you can restart network time synchronization:

Terminal window
sudo timedatectl set-ntp false
timedatectl status
sudo timedatectl set-ntp true
timedatectl status

If the time is still incorrect, temporarily set it manually:

Terminal window
sudo date -s 'YYYY-MM-DD HH:MM:SS'

Then open the Raspberry Pi configuration utility:

Terminal window
sudo raspi-config

Check that the correct time zone is configured.

Once the system time is correct, retry the commands that were previously failing.

If you did not enable SSH through Raspberry Pi Imager, you can enable it later with:

Terminal window
sudo raspi-config

Navigate to:

Interface Options → SSH → Yes

Press Enter to select each option.

You can also enable SSH through Preferences → Raspberry Pi Configuration in the desktop interface.

You can create a compressed image of an existing Raspberry Pi SD card from another Linux system.

First, connect the SD card and determine its device name.

Create the backup:

Terminal window
sudo dd if=<device> status=progress bs=32M | gzip -c > <path-to-backup>/raspberrypi.img.gz

To restore the backup:

Terminal window
gunzip -c <path-to-backup>/raspberrypi.img.gz | sudo dd of=<device> status=progress bs=32M

The backup is compressed with gzip so that the resulting file does not necessarily occupy the full capacity of the SD card.

To clone one SD card directly to another, connect both cards to the computer and determine their device names.

Clone the card with:

Terminal window
sudo dd bs=32M if=<input-device> of=<output-device>

Once the command completes, the output SD card will contain a copy of the original card.