How to set up a headless Raspberry Pi on Windows 11: Flashing the OS, setting up Wi-Fi and SSH

Raspberry Pi Zero
(Image credit: Windows Central)

The only limit to what you can do with a Raspberry Pi is your imagination, but even if your ambitions are a little more basic, there's still lots of fun to be had. In many use cases, you'll be looking at using a Raspberry Pi headless, that is to say without it being attached to a display. It's also perfectly possible to set it up this way using your Windows 10 or Windows 11 PC. Here's how.

Grabbing the software you need

(Image credit: Windows Central)

Before you do anything, you'll need both a copy of the OS for the Raspberry Pi and something to flash an image of it to the microSD card. Raspberry Pi has its own imager but for the purposes of this guide we're using a third-party app called balenaEtcher since it has uses beyond just the Raspberry Pi and is a useful tool to have around.

Then you'll need to go to the Raspberry Pi downloads page and grab a copy of the OS. We're just going to use the standard Raspberry Pi OS for this guide, a customized version of Debian Linux built especially for the Raspberry Pi. There are various downloads available from the Raspberry Pi website, but for the purposes of what we're trying to do here grab a copy of the "Lite" download.

You ideally want the Lite version for headless setup, especially on a Raspberry Pi Zero, as it's a much lighter image with a smaller download footprint and importantly, no desktop UI. As we won't be using it there's no need to waste resources on it.

How to flash the Raspberry Pi OS image on Windows 10 and Windows 11

(Image credit: Samsung)

The first step is to flash your microSD card with the OS image for the Raspberry Pi.

  1. Locate the downloaded zip file of the Raspberry Pi OS Lite image.
  2. Extract the files and note the location of the extracted image.
  3. Load up balenaEtcher on your PC.
  4. Select Flash from file.
  5. Select your extracted Raspberry Pi OS image from step 2.
  6. Connect your microSD card to your PC.
  7. Click Select target.
  8. Choose your microSD card.
  9. Click Flash.

(Image credit: Windows Central)

BalenaEtcher will now run through a short process that should only take a couple of minutes (depending on your hardware), and when you're done leave it attached to your PC for the next step.

How to set up Wi-Fi and SSH access on your Raspberry Pi

(Image credit: Windows Central)

The key to being able to set up a headless Raspberry Pi is being able to connect to it from your Windows PC. For that, you'll need it to be on your local network, and while you could use Ethernet, on the Raspberry Pi Zero, in particular, this requires additional hardware and it's really not necessary.

To connect the Raspberry Pi to your home network and allow remote access we need to ensure it has two things:

  • Your Wi-Fi network SSID and password
  • SSH

Both of these we'll add from your PC.

  1. Ensure your Raspberry Pi OS microSD card is attached to your PC.
  2. Open File Explorer.
  3. Select the microSD card, it should be called boot.
  4. Within the root directory, right-click and select New then Text Document.
  5. Name this file ssh.
  6. Right-click and select Rename.
  7. Delete the .txt extension.
  8. When prompted to confirm, click yes.

It's important to make sure the blank file has no file extension to function properly. You'll know it has been successfully changed as the icon will now look like a blank piece of paper compared to one with lines on it.

(Image credit: Windows Central)

Next, we'll build a file containing your Wi-Fi network credentials.

  1. Ensure your Raspberry Pi OS microSD card is attached to your PC.
  2. Open File Explorer.
  3. Select the microSD card.
  4. Within the root directory, right-click and select New then Text Document.
  5. Rename this file to wpa_supplicant.conf ensuring that the .txt file extension has been replaced.
  6. When prompted to confirm, click yes.
  7. Right-click on the file and choose Open with ....
  8. Select Notepad or your own preferred text editor.

Once you have the wpa_supplicant.conf file open in a text editor, you'll need to enter some code to tell your Raspberry Pi how to connect to your network. Set up your file like the image above.

Enter the name of your Wi-Fi network inside the ssid quotation marks and your network password inside the psk quotation marks. Then save the file. Also, ensure you change the country to the two-letter code for your location.

Then save the file and close Notepad.

How to set up the Raspberry Pi using SSH

(Image credit: Windows Central)

There was a time that you'd have to install a third-party application such as PuTTY to use SSH on Windows, but that's not the case anymore; you can simply do it through the terminal. PowerShell works just fine, but if you have WSL enabled you can also use the Linux terminal assuming you have SSH enabled in it. Ubuntu, for example, has it out of the box, but Debian does not.

For this, we'll be using PowerShell. Before getting started, make sure the boot microSD is inserted in the Raspberry Pi and that you power it on. You also need to find out the IP address on your network for the Raspberry Pi. There are many ways to do this, but the easiest is to just look in your router's settings for connected devices and locate it there. If you're only using one Raspberry Pi on your network, the default command below can be used. 

pi@raspberrypi.local

Then follow these steps.

  1. Open Windows PowerShell.
  2. Type ssh pi@yourIPaddress.
  3. When prompted at the authenticity message, type yes and press enter.
  4. When prompted for a password, enter raspberry.

You should now be presented with a short welcome blurb from Linux having successfully connected to the Raspberry Pi. The prompt will also have changed from PowerShell to pi@raspberrypi.

The first thing to do is to change the default password from raspberry.

(Image credit: Windows Central)
  1. In the terminal type passwd.
  2. When asked for the current password, enter raspberry.
  3. Choose a new password and press enter.
  4. Confirm the new password and press enter.

Assuming they match, you'll see a confirmation message that you successfully changed the password. This is now the password you'll use when logging in to your Raspberry Pi over SSH.

The basic setup of the Raspberry Pi is now done, but there are a couple of basic commands to run first before you exit out of it. These are basic Linux commands that you'll use quite often, but essentially it'll ensure your Raspberry Pi is all up to date. Enter these two commands:

sudo apt update
sudo apt upgrade

The first run-through of these commands may take some time, especially on a Pi Zero. Then, once you're done with your Raspberry Pi, you can quit back to regular old Powershell simply by typing ''quit'' into the terminal.

While you can use PowerShell or any installed WSL Linux distros to SSH into your Raspberry Pi, if you're going to eventually handle multiple machines there are more elegant ways to handle and manage your connections. On Windows, there's the old favorite, PuTTY as well as the popular and elegant cross-platform client, Termius.

And that's all you need to know. By now you'll have a fully functioning Raspberry Pi that you can interact with and get creative with all without the need for a display, mouse, and keyboard.

This process is the same whether you go for the Raspberry Pi Zero or the regular model, but the Pi Zero is a great way to dip your toe and start to learn about Raspberry Pi. If you're new to things like SSH, terminal, or even just Linux in general, it's such an affordable way to get started and learn some new skills, with the added bonus that the maker ecosystem is enormous. The only limit is your imagination.

TOPICS
CATEGORIES
Richard Devine
Managing Editor - Tech, Reviews

Richard Devine is a Managing Editor at Windows Central with over a decade of experience. A former Project Manager and long-term tech addict, he joined Mobile Nations in 2011 and has been found on Android Central and iMore as well as Windows Central. Currently, you'll find him steering the site's coverage of all manner of PC hardware and reviews. Find him on Mastodon at mstdn.social/@richdevine