Raspberry PI OS Lite: Headless Install, Setup and Configure

4.4
(18)

Despite its price and size, Raspberry PI is a computer. For this reason, the most important part resides in its operating system. People looking for a fast, lightweight and headless basis usually prefer Raspberry PI OS Lite for their board because it is performing, fully compatible and supported by Raspberry PI Foundation.

In this tutorial I will show you how to install Raspberry PI OS Lite edition, the official Raspberry PI Foundation free Operating System without a graphical user interface.

Using Raspberry PI for a number of home applications is something fantastic. But Raspberry PI comes with low performance hardware. So many times you could need to use as many resources as possible dedicated to your applications, instead of wasting them on apps that you don’t need (for example desktop environment). For this reason, Raspberry PI Foundation released 3 different OS versions (you can also compare them in Raspberry PI OS Desktop vs Lite article), all based on the same Linux distribution (Debian).

Usually, Raspberry PI kits come with NOOBS pre-installed inside an SD card, but you can also choose to install directly a minimal core and use it from your external PC by SSH with only a command line.

From February 2022, Raspberry PI Foundation finally released its official 64-bit OS release. So, from this date, you can choose between the common 32-bit distribution and the new 64-bit one. Please note that you are forced to use a 32-bit image if you have Raspberry PI 1, Raspberry PI 2 and Raspberry PI Zero computer boards, as their CPU relies on armhf architecture and it doesn’t support the 64-bit instruction set. Newer Raspberry PI computer boards (including Raspberry PI Zero 2) can use both the 32 and 64 bit images.

If you need to download the image, the 2 distributions can be get with the following links:

Once get the distribution, the installation procedure will be the same in both cases.

If you are interested in the previous version (Raspbian Buster Lite), please refer to install Raspbian Buster Lite.

If you are interested in Raspberry PI OS Desktop, please refer to install Raspberry PI OS Desktop guide, which will guide you to install a complete desktop computer.

Finally, please note that this tutorial is for Raspberry PI computer boards: the new Raspberry PI Pico is a microcontroller and is something different. For this board, you can refer to the First steps with Raspberry PI Pico for Beginners.

Follow peppe8o posts on -> Twitter

What do you need

As usual, I suggest adding from now to your favourite e-commerce shopping cart all the needed hardware, so that at the end you will be able to evaluate overall costs and decide if continue with the project or remove them from the shopping cart. So, hardware will be only:

Raspberry PI 4 model B image

I strongly suggest evaluating buying a case with cooling system (fan) if you are thinking to use your Raspberry PI for resource-intensive applications. You also need a PC (notebook or desktop) with an SD card reader.

Step-by-step guide

There are 2 main methods to install Raspberry PI OS Lite. The first one is using the official Raspberry PI Imager tool. The second one is using flashing software like, for example, Etcher.

The first method is simpler, but sometimes (in really rare cases) I’ve found that, for a somewhat strange reason, some minor things on the same OS installed with RPI Imager don’t work as when installed with Etcher.

Please note that in both cases you have to run the installation software with administrative permissions.

Method 1: Install Raspberry PI OS Lite with Raspberry PI Imager

Take the RPI Imager installation software from Raspberry Pi download page and install it according to your OS. Once installed, please run the Imager with administrative permissions. You will get the RPI Imager open:

RPI imager 1.7.1

With the “Choose OS” button, please enter the sub-menu “Raspberry PI OS (other)”. Then select “Raspberry PI OS Lite (32-bit)” or “Raspberry PI OS Lite (64-bit)” according to your board and project needs.

RPI imager 1.7.1 OS Lite

With the Micro Sd storage plugged in the PC running the RPI Imager, you can now select the Storage with the “Choose Storage” button:

RPI imager 1.7.1 OS Lite Storage

From Raspberry PI Imager 1.7.1, the Foundation added to its official flashing software the ability to pre-configure some settings in order to be ready from the very first boot. Press the gear button below the “Write button” to ccess the ability to pre-configure WiFi, enabling SSH, timezone and so on:

RPI imager 1.7.1 OS Lite Options

IMPORTANT NOTE: with my Windows 11 I had a lot of issues to get these advanced options working for the first boot in headless mode. For example, the Raspberry PI was performing the first boot without WiFi, making the installation “useless” instead of “headless”… The fix that worked for me was disabling the “Eject media when finished” option from advanced settings.

Set according to your preference and click Save. You can start the image writing with the “Write” button. Once write (and verification) operations are successfully completed, a notification will be shown:

RPI imager 1.7.1 OS Lite Write Successful

If you find any errors here, please try again to write the image and/or try changing the Micro SD storage.

Now you can unmount and extract the storage from your PC, then insert it in your Raspberry PI and power on it. From here you can go to the “Final Operations” chapter of this tutorial.

Method 2: Install Raspberry PI OS Lite with Etcher

Download and install Etcher on your PC (if not already available).

Download Raspberry PI OS Lite disk image (ZIP version) in a local folder. As mentioned above, you can get both the 64-bit and the 32-bit versions from the following links:

Insert your SD card in your PC/SD card reader.

Run Etcher on your PC.

Etcher

Click Select Image and select Raspberry PI OS disk image previously downloaded. Etcher should also have already recognised your SD card. Otherwise, click change and select the correct SD card.

Install Raspberry PI OS Buster Etcher

Click on “Flash! button and wait for the operation to be completed.

Etcher_3

Pre-Configure WiFi and SSH Server

In my case, I don’t want to use an HDMI connection to my TV in order to finalize the system setup (my Raspberry will be connected only via Wi-Fi). So, before using it and after having flashed its SD, let’s configure Wi-Fi and SSH connection directly modifying files inside the SD card.

Extract the SD card and re-insert it into your PC. From your file explorer, in “This Computer” we can see 1 SD partition:

raspberry PI OS partitions on setup

We will create a connection configuration file under the boot partition.
Open your notepad and paste the following lines:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=«your_ISO-3166-1_two-letter_country_code»

network={
        scan_ssid=1
        ssid="«your_SSID»"
        psk="«your_PSK»"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
}

Replace «your_ISO-3166-1_two-letter_country_code» with your ISO Country Code (such as US for United States), «your_SSID» with your wireless access point name and «your_PSK» with your wi-fi password.
Save this file under the boot partition, naming it “wpa_supplicant.conf”.

In addition, we will create a new file named “ssh” (without extension) under the boot partition also to enable SSH in our raspberry. It is not important what is contained in this file: when Pi boots, it looks for the “ssh” file and if it is found, SSH is enabled and then the file is deleted.

So, let’s open a new Notepad window:

Notepad_Window

Go to: File -> Save as

change-default-save-location-windows7.png

Select the boot partition from the SD card in the left column.

Insert in “File name” field value “ssh” and click “Save”. Be aware that notepad sometimes saves files by adding “.txt” extension. So, control the saved file and be sure that its extension is NOT included.

Extract the SD card from your SD reader and insert it into your Raspberry PI.

From 2022, the Raspberry PI Foundation removed the default “pi” user with password “raspberry” because of security problems having this user created by default. Instead of this, you can create your very first user by generating an encrypted password from an OpenSSL terminal command:

openssl passwd -6

This command will ask you for the desired password and for confirmation. It will produce as output a characters string that is your encrypted password. put it in a file named “userconf.txt”, containing only the username you choose (plain text) and the encrypted password, divided by column:

my_user:my_enctypted_password

Close and save the file in the boot partition of your Raspberry PI micro SD card.

So, in the end the files that you must save in the boot partition to get your Raspberry PI OS Lite working with a headless (without monitor/keyboard) setup will be:

wpa_supplicant.conf
ssh
userconf.txt

Final Operations

Power the Raspberry PI on and wait a few minutes for the first boot. Check its IP address in your router and connect to it from Putty (or whatever connection program you are using for ssh). Please remember, if required, that the default ssh port (22).

Use your Username / Password to login.

Make the Operating System up-to-date. From the command line:

sudo apt update && sudo apt upgrade

Next Steps: Advanced Configurations

After finishing the Operating System installation, you may need the following setup:

What’s Next

If you are interested in more Raspberry PI projects, look at my Raspberry PI tutorials.

Enjoy your Raspberry PI OS Lite edition!

How useful was this post?

Click on a star to rate it anonymously!

Average rating 4.4 / 5. Vote count: 18

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?