In this tutorial, we’ll do a complete Raspberry Pi setup on a Raspberry Pi 5, from a blank microSD card to a board you control from your PC. You’ll learn how to flash Raspberry Pi OS with Raspberry Pi Imager, preconfigure the Wi-Fi network, the user account and SSH so the Pi works without a monitor (a Raspberry Pi headless setup), find the board on your network, connect to it over SSH, and keep it updated.
Then, we’ll cover the things most setup guides skip: changing Wi-Fi from the command line with NetworkManager (the old wpa_supplicant.conf file no longer works), what the Raspberry Pi 5 does with a 3A power supply instead of a 5A one, and a first test program in Python and C++ that proves your board is ready for the GPIO tutorials that follow. Without further ado, let’s get right into it!
Note: All steps in this tutorial are tested with: Raspberry Pi 5 (8GB) with Raspberry Pi OS (64-bit) Trixie, and Raspberry Pi Imager.
Raspberry Pi Setup in 6 Steps
To set up a Raspberry Pi 5 without a monitor, keyboard, or mouse, do the following:
- Install Raspberry Pi Imager on your PC and insert a microSD card (16GB or larger).
- In Imager, choose Raspberry Pi 5, Raspberry Pi OS (64-bit), and your microSD card.
- In the Customisation step, set a hostname, your time zone, a username and password, your Wi-Fi name and password, and turn on SSH.
- Write the card, put it in the Raspberry Pi, and power it with a 5V 5A USB-C supply (the official 27W supply).
- Wait for the first boot to finish, then connect from your PC: ssh pi@pi5.local.
- Update the OS with sudo apt update && sudo apt full-upgrade -y.
The rest of this tutorial goes through each step with screenshots from the current Imager version, explains what to do when the Pi doesn’t show up on the network, and ends with a checklist that confirms your Raspberry Pi is ready.
What You Need for a Raspberry Pi Setup
A headless Raspberry Pi setup needs only the board, a microSD card, a power supply, and a computer on the same network. You don’t need a monitor, a keyboard, or a mouse. This is the Raspberry Pi 5 (8GB) I used for this tutorial, on my bench:

| QTY. | Component Name | Amazon.com | AliExpress |
|---|---|---|---|
| 1 | Raspberry Pi 5 (4GB or 8GB) | Amazon | AliExpress |
| 1 | Raspberry Pi 27W USB-C Power Supply (5.1V 5A) | Amazon | AliExpress |
| 1 | microSD Card (32GB, A2 / U3 recommended) | Amazon | AliExpress |
| 1 | USB microSD Card Reader | Amazon | AliExpress |
| 1 | Raspberry Pi 5 Active Cooler | Amazon | AliExpress |
| 1 | Raspberry Pi 4 Model B (optional, for the Pi 4 notes) | Amazon | AliExpress |
Besides the hardware, you need a Windows, macOS, or Linux computer with Raspberry Pi Imager installed (download it from the official Raspberry Pi software page), your Wi-Fi network name and password, or an Ethernet cable to your router.
Note: The Raspberry Pi 5 needs a 5V 5A USB-C Power Delivery supply to run at its full USB current. A common 5V 3A phone charger boots it, but the Pi 5 then limits its USB ports to 600mA in total and shows a power warning. The details are in the Raspberry Pi 5 power supply section below.
Step 1: Flash Raspberry Pi OS With Raspberry Pi Imager
Raspberry Pi Imager writes the operating system to the microSD card and, in the same pass, stores your hostname, user account, Wi-Fi, and SSH settings on it. Imager 2 walks through six steps listed on its left side: Device, OS, Storage, Customisation, Writing, and Done. These are the screens from Imager 2.0.12, the current version.
#1
Open Raspberry Pi Imager and select your board, Raspberry Pi 5, then click NEXT.

#2
Choose Raspberry Pi OS (64-bit). It’s the recommended OS at the top of the list, a port of Debian Trixie with the Raspberry Pi desktop.

For a Raspberry Pi that will only run headless, Raspberry Pi OS Lite (64-bit) under Raspberry Pi OS (other) is a smaller image (550MB download) with no desktop. The desktop version is still the better first choice, because the remote desktop tutorials need it. For this tutorial, I used Raspberry Pi OS Full (64-bit), the desktop with the recommended applications, which I had already downloaded.
#3
Select your microSD card on the Storage step and click NEXT. Keep Exclude system drives checked, so Imager never lists your PC’s own disks.

Note: Writing erases everything on the selected card. Check its size before you continue: a 16GB card shows as about 15.9GB.
#4
In the Customisation step, type a hostname. It’s the name you’ll use to reach the board on your network ( pi5.local here).

#5
Set your Localisation: pick your national capital, and Imager fills in the time zone and keyboard layout.

#6
Create your user account: a username and a password. Raspberry Pi OS has no default pi user or raspberry password anymore, so this account is the only way in.

#7
Enter your Wi-Fi network name (SSID) and password. Skip it if the Pi will use an Ethernet cable.

#8
In Remote access, turn on Enable SSH and keep Use password authentication.

Password authentication is the simplest start. If you already have an SSH key on your PC, Use public key authentication lets Imager install it, and you’ll log in without a password.
#9
Leave Raspberry Pi Connect off for now. It’s the official browser-based remote access service, and it needs a Raspberry Pi ID account.

#10
Review the summary. It lists the customisations Imager will apply. Then click WRITE.

#11
Confirm with I UNDERSTAND, ERASE AND WRITE, and wait for the writing and the verification to finish.

On my USB card reader, writing the 10GB image took about 20 minutes and the verification about 7 minutes. Imager shows the speed under the progress bar: “Limited by storage device speed” means the card or the reader is the bottleneck, not the PC.
Use an Image File You Already Downloaded
If you’ve already downloaded the .img.xz file (or you want to keep a copy for later), choose Use custom at the bottom of the OS list and select the file. Check its SHA-256 against the value on the Raspberry Pi OS download page first.

Note: In Imager 2.0.12, a custom image skips the Customisation step: no hostname, user, Wi-Fi, or SSH settings are written. On a headless Raspberry Pi, that means no way in. Use the image from Imager’s OS list when you want customisation.
Step 2: Boot Your Raspberry Pi 5 for the First Time
Put the microSD card in the slot on the underside of the Raspberry Pi 5, connect the power supply, and wait. The first boot takes longer than the next ones, because Raspberry Pi OS expands the file system to the full card, applies your Imager settings, and reboots once.
On my Raspberry Pi 5, SSH answered about 90 seconds after I connected power, and systemd-analyze reported 1 min 12 s for that first boot. After the upgrade and a reboot, a normal boot took 20.7 seconds. If your PC gets Connection refused in that window, the Pi is still finishing its first boot: wait a minute and try again.
The green ACT LED flickers while the Pi reads the card. If it stays off and the red power LED is on, the board isn’t finding a bootable card: reflash it and check that it’s fully inserted.
Step 3: Find Your Raspberry Pi on the Network
Your PC reaches the Raspberry Pi by its hostname plus .local, for example pi5.local. Windows 10 and 11, macOS, and most Linux desktops resolve these names with mDNS, so you rarely need the IP address. Test it from a terminal on your PC:
|
1 |
ping -4 pi5.local |
If the name doesn’t resolve, find the IP address in your router’s list of connected devices (the device name is your hostname), or list your PC’s ARP table and look for a Raspberry Pi MAC address prefix ( 2c:cf:67 on the Raspberry Pi 5, d8:3a:dd and dc:a6:32 on the Raspberry Pi 4):
|
1 |
arp -a |
Step 4: Connect to Your Raspberry Pi Over SSH
SSH is already enabled because you turned it on in Imager. Open PowerShell or Windows Terminal (Terminal on macOS and Linux) and connect with your username and hostname:
|
1 |
ssh pi@pi5.local |
The first time, SSH shows the Pi’s key fingerprint and asks whether to trust it. Type yes, then your password. You’ll get the Raspberry Pi’s prompt, pi@pi5:~ $, and every command you type now runs on the Raspberry Pi.
After the password, the Raspberry Pi greets you with its kernel version and the Debian notice:
Don’t use sudo in front of ssh on your PC, and don’t log in as pi@raspberrypi unless those are the names you chose: older tutorials show that default user and hostname, which current Raspberry Pi OS doesn’t create.
Step 5: Update Raspberry Pi OS
Even a fresh image is a few weeks old, so install the latest packages and firmware before anything else:
|
1 2 |
sudo apt update sudo apt full-upgrade -y |
On my Raspberry Pi 5, the first full upgrade of the 2026-10-06 image upgraded 224 packages and installed 24 new ones, including a new kernel (6.18.60). It downloaded 786MB in about 4 minutes, and the whole run took 21.5 minutes, most of it writing to the microSD card. Let it finish without interrupting the power.
Reboot when the upgrade installed a new kernel or firmware ( sudo reboot), and reconnect with SSH after about half a minute.
Raspberry Pi Wi-Fi Setup From the Command Line
Raspberry Pi OS manages networks with NetworkManager, so you add or change a Wi-Fi network with nmcli. Imager’s Wi-Fi settings are stored the same way, as a NetworkManager connection.
List the networks the Raspberry Pi can see:
|
1 |
nmcli device wifi list |
Connect to a network (the --ask option prompts for the password, so it isn’t saved in your shell history):
|
1 |
sudo nmcli --ask device wifi connect "YourWiFiName" |
Show the saved connections and the active one:
|
1 |
nmcli connection show |
If you change the Wi-Fi network over SSH, the Pi drops your SSH session when it leaves the old network. Do it with the new network in range, then reconnect with ssh pi@pi5.local. For an interactive menu instead of commands, run sudo nmtui.
Why wpa_supplicant.conf No Longer Works
Many Raspberry Pi tutorials still tell you to put a wpa_supplicant.conf file (and an empty ssh file) on the card’s boot partition. That worked up to Raspberry Pi OS Bullseye. Since Bookworm, NetworkManager handles Wi-Fi, and the OS ignores that file, so the Pi boots without a network. On current Raspberry Pi OS, set Wi-Fi in Imager, or with nmcli once you’re in.
Raspberry Pi 5 Power Supply: 5A vs 3A
The Raspberry Pi 5 asks its USB-C supply for 5V at 5A through USB Power Delivery. With a supply that offers 5A, it allows 1.6A in total for USB devices. With a 3A supply, it still boots and runs, but it limits the USB ports to 600mA in total, according to the Raspberry Pi power supply documentation.
| Model | Recommended Supply | USB Peripheral Current | Bare-Board Current (Typical) |
|---|---|---|---|
| Raspberry Pi 5 | 5.1v 5A USB-C PD (27W) | 1.6A (600mA on a 3A supply) | 800mA |
| Raspberry Pi 4 | 5.1v 3A USB-C | 1.2A | 600mA |
I measured this on my own bench. My Raspberry Pi 5 ran from a 65W USB-C laptop charger through a USB-A to USB-C cable. A USB-A cable can’t negotiate Power Delivery, so the Pi received no PD offers at all and set its current limit to 900mA, the default USB value, with usb_max_current_enable=0. It still booted and ran stable at idle and during the full upgrade: the input measured 5.03v and vcgencmd get_throttled stayed at throttled=0x0. But the USB ports were held to the low-current limit, so a USB SSD or another power-hungry device can fail. A 65W rating doesn’t mean 5V 5A: most laptop chargers offer 3A at 5V. For the full 1.6A of USB current, use the official 27W supply (or another USB-C PD supply that lists 5V 5A) with a USB-C to USB-C cable.
You can check for under-voltage at any time. vcgencmd get_throttled returns throttled=0x0 when the supply has never dropped too low since boot. Any other value means it did (bit 0 is under-voltage now, bit 16 is under-voltage since boot).
|
1 |
vcgencmd get_throttled |
These are the commands I used to read the power state of my Raspberry Pi 5 on the USB-A cable: the throttle flags, the input voltage measured by the Pi’s power management chip, the USB current setting, and the supply current limit the firmware chose (in mA).
Test Your Raspberry Pi Setup With Python and C++
The last step proves that the board runs your own code. The two programs below do the same job in Python and in C++: they print the board model, the OS release, the kernel, the CPU temperature, and the power status. Every later Raspberry Pi tutorial on this site shows its examples in both languages, so this also checks that both toolchains work.
Raspberry Pi Python Test Program
Python 3 comes with Raspberry Pi OS. Create the file with nano pi_check.py, paste the code, and save it with Ctrl+O, then exit with Ctrl+X.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
#!/usr/bin/env python3 """ LAB Name: Raspberry Pi Setup Check (Python) Author: Khaled Magdy For More Info Visit: www.DeepBlueMbedded.com Prints the board model, the OS release, the kernel, the CPU temperature and the power/throttle status, so you can confirm a fresh Raspberry Pi setup works before moving on to GPIO projects. """ import platform import subprocess def read_text(path): try: with open(path) as f: return f.read().strip().strip("\x00") except OSError: return "n/a" def os_release(): info = {} for line in read_text("/etc/os-release").splitlines(): key, _, value = line.partition("=") info[key] = value.strip('"') return info.get("PRETTY_NAME", "n/a") def cpu_temp_c(): raw = read_text("/sys/class/thermal/thermal_zone0/temp") return int(raw) / 1000 if raw.isdigit() else None def throttled(): # vcgencmd ships with Raspberry Pi OS; 0x0 means no under-voltage or throttling try: out = subprocess.run(["vcgencmd", "get_throttled"], capture_output=True, text=True, timeout=5) return out.stdout.strip() or out.stderr.strip() except (OSError, subprocess.TimeoutExpired): return "vcgencmd not available" print("Board :", read_text("/proc/device-tree/model")) print("OS :", os_release()) print("Kernel :", platform.release(), platform.machine()) print("Python :", platform.python_version()) t = cpu_temp_c() print("CPU :", f"{t:.1f} C" if t is not None else "n/a") print("Power :", throttled()) print("Your Raspberry Pi is set up and running Python code!") |
Run it:
|
1 |
python3 pi_check.py |
Raspberry Pi C++ Test Program
The C++ version uses only the standard library. Install the compiler tools once (they may already be there on the desktop image):
|
1 |
sudo apt install -y build-essential cmake pkg-config |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
/* * LAB Name: Raspberry Pi Setup Check (C++) * Author: Khaled Magdy * For More Info Visit: www.DeepBlueMbedded.com * * Prints the board model, the OS release, the kernel, the CPU temperature * and the power/throttle status, so you can confirm a fresh Raspberry Pi * setup compiles and runs C++ code. * Build: g++ -std=c++17 -O2 -Wall pi_check.cpp -o pi_check * Run: ./pi_check */ #include <array> #include <cstdio> #include <fstream> #include <iostream> #include <sstream> #include <string> #include <sys/utsname.h> static std::string ReadText(const std::string &path) { std::ifstream f(path); if (!f) return "n/a"; std::stringstream ss; ss << f.rdbuf(); std::string s = ss.str(); // device-tree strings end with a NUL, files end with a newline while (!s.empty() && (s.back() == '\0' || s.back() == '\n')) s.pop_back(); return s; } static std::string OsRelease() { std::ifstream f("/etc/os-release"); std::string line; while (std::getline(f, line)) { if (line.rfind("PRETTY_NAME=", 0) == 0) { std::string v = line.substr(12); if (v.size() >= 2 && v.front() == '"') v = v.substr(1, v.size() - 2); return v; } } return "n/a"; } static std::string Throttled() { // vcgencmd ships with Raspberry Pi OS; 0x0 means no under-voltage or throttling std::array<char, 128> buf{}; std::string out; FILE *p = popen("vcgencmd get_throttled 2>&1", "r"); if (!p) return "vcgencmd not available"; while (fgets(buf.data(), buf.size(), p)) out += buf.data(); pclose(p); while (!out.empty() && out.back() == '\n') out.pop_back(); return out; } int main() { utsname u{}; uname(&u); std::string t = ReadText("/sys/class/thermal/thermal_zone0/temp"); std::cout << "Board : " << ReadText("/proc/device-tree/model") << "\n"; std::cout << "OS : " << OsRelease() << "\n"; std::cout << "Kernel : " << u.release << " " << u.machine << "\n"; std::cout << "GCC : " << __VERSION__ << "\n"; if (t != "n/a") { char temp[16]; std::snprintf(temp, sizeof temp, "%.1f C", std::stoi(t) / 1000.0); std::cout << "CPU : " << temp << "\n"; } std::cout << "Power : " << Throttled() << "\n"; std::cout << "Your Raspberry Pi is set up and running C++ code!" << std::endl; return 0; } |
Compile and run it:
|
1 2 |
g++ -std=c++17 -O2 -Wall pi_check.cpp -o pi_check ./pi_check |
Neither program needs sudo. If both print your board and OS, your Raspberry Pi is ready for the next tutorials in our series.
Raspberry Pi 5 vs Raspberry Pi 4 Setup Differences
The setup steps are the same on the Raspberry Pi 4: choose Raspberry Pi 4 in Imager’s device list and the same 64-bit OS. These are the differences that matter while setting up:
| Item | Raspberry Pi 5 | Raspberry Pi 4 |
|---|---|---|
| Power supply | 5.1v 5A USB-C PD (27W); 3A works with a 600mA USB limit | 5.1v 3A USB-C |
| Cooling | Active Cooler or a fan case recommended | Passive heatsink is enough for most uses |
| Boot from NVMe | Yes, through the PCIe connector and an M.2 HAT | No (USB boot only) |
| Power button | Yes, on the board | No |
| GPIO hardware | RP1 I/O controller (gpiochip0 [pinctrl-rp1]) | Broadcom SoC GPIO |
| RPi.GPIO | Not supported by the original library; Raspberry Pi OS ships the rpi-lgpio replacement. Use gpiozero for new code | Supported |
I ran every step in this tutorial on the Raspberry Pi 5. The Raspberry Pi 4 column comes from the official Raspberry Pi documentation.
Your Raspberry Pi Is Ready When…
Every Raspberry Pi tutorial you’ll find here (on DeepBlueMbedded) starts from this state. Check each item:
- It boots Raspberry Pi OS (64-bit) and answers ping pi5.local from your PC.
- You can log in with ssh pi@pi5.local (your own username and hostname).
- sudo apt update reports no errors, and sudo apt full-upgrade has nothing left to install.
- vcgencmd get_throttled prints throttled=0x0.
- python3 pi_check.py and ./pi_check both print your board and OS.
Raspberry Pi Setup Troubleshooting
Imager: “Error writing to storage device during preparing storage device”
On Windows, this error can come from Controlled folder access (ransomware protection), which blocks Imager from writing to disks. Add Imager in Windows Security > Virus & threat protection > Manage ransomware protection > Allow an app through Controlled folder access, then write again. I hit exactly this on my PC. Other causes are the card’s lock switch, a faulty reader, or a worn-out card.

ssh: Could not resolve hostname pi5.local
Your PC can’t resolve the mDNS name. Wait a minute after the first boot, check that your PC and the Pi are on the same network, and try ping -4 pi5.local. If it still fails, connect by IP address from your router’s device list: ssh pi@192.168.1.x.
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
You reflashed the card, so the Pi has a new host key, and your PC still remembers the old one. Remove the old key and connect again: ssh-keygen -R pi5.local.
apt: OpenPGP signature verification failed … Not live until
Right after the first boot, apt update can fail with this error because the Raspberry Pi has no battery-backed clock: it starts with the image’s date until it syncs the time over the network. On my Raspberry Pi 5, the first-boot update showed exactly this error, and it was gone a minute later. Check timedatectl for System clock synchronized: yes, then run the update again.
Permission denied, please try again
The username or password doesn’t match what you set in Imager. Usernames are lowercase. If you chose public key authentication, your PC must have that key.
The Raspberry Pi doesn’t join Wi-Fi
Check the network name and password in Imager (they’re case-sensitive) and that the Wi-Fi country (from Localisation) matches yours, then rewrite the card. The Raspberry Pi 5 and 4 support 2.4GHz and 5GHz networks. A wired Ethernet connection is the quickest way in to fix Wi-Fi with nmcli.
error: externally-managed-environment (pip install)
Raspberry Pi OS doesn’t let pip install packages into the system Python. Install the Debian package instead ( sudo apt install python3-<name>), or create a virtual environment for your project with python3 -m venv --system-site-packages env.
Raspberry Pi Setup FAQ
What size microSD card do I need for a Raspberry Pi 5?
Raspberry Pi recommends at least 32GB for Raspberry Pi OS with desktop and 8GB for Raspberry Pi OS Lite. A 16GB card holds the desktop image (I used one for this tutorial), but leaves little room for updates and projects.
Can I set up a Raspberry Pi without Imager?
You can write the image with another tool, but then the OS asks for a user on first boot, which needs a monitor and keyboard. Imager’s customisation is the supported way to preconfigure a headless Raspberry Pi on current Raspberry Pi OS.
Should I use Raspberry Pi OS Lite or the desktop version?
Use Lite for a board that only runs services and scripts over SSH. Use the desktop version if you’ll ever want a graphical desktop, a browser, or remote desktop (VNC).
Wrap Up
To conclude this tutorial, we’ve set up a Raspberry Pi 5 from a blank card to a board you control over SSH: Raspberry Pi OS (64-bit) written and preconfigured with Raspberry Pi Imager, Wi-Fi managed with NetworkManager, the power supply checked, and a Python and C++ test program running on the board. The same steps set up a Raspberry Pi 4.
Your Raspberry Pi is now ready for the Raspberry Pi tutorial series here on my website. Each of them starts from the checklist above, so you can come back to this page whenever you set up a new board or reflash a card.