Raspberry PI OS Lite: Headless Install, Setup and Configure

4.4
(20)

Last Updated on 2nd September 2023 by peppe8o

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.

Step-by-Step Instructions for Installing and Configuring Raspberry Pi OS Lite on Your Raspberry Pi Device: A Comprehensive Guide With Links to Optimizing Performance, Customizing Settings, and Exploring Advanced Features for Hobbyists, Makers, and Developers.

What is Raspberry PI OS Lite

Raspberry Pi OS Lite is a lightweight operating system designed for use on the Raspberry Pi single-board computer. It is a minimalist version of the full Raspberry Pi OS, optimized for users who want an operating system that doesn’t come pre-installed with a lot of unnecessary software.

It is ideal for projects that require a low-overhead operating system that can be customized to suit the user’s needs. With Raspberry Pi OS Lite, users have full control over their system and can add only the software packages they need, making it a popular choice for hobbyists, makers, and developers.

The OS is based on the Debian operating system and includes a range of powerful tools and utilities that make it easy to configure and manage the Raspberry Pi device.

Overall, Raspberry Pi OS Lite is a versatile, flexible, and lightweight operating system that provides a solid foundation for a wide range of Raspberry Pi projects.

More about Raspberry PI OS

The 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).

Sometimes, 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.

In 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.

With Raspberry PI Imager software, you don’t need to download the OS image to your PC. But if you need to download the image, you can get the 2 distributions with the following links:

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

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.

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 of using 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 I suggest running the installation software with administrative permissions in both cases.

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

Take the RPI Imager installation software from the 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:

Raspberry PI Imager home

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.

imager-raspberry-pi-os-lite-selected

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

imager-raspberry-pi-os-lite-storage-selected

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 access the ability to pre-configure WiFi, enabling SSH, timezone and so on:

imager-raspberry-pi-os-lite-options-wifi

IMPORTANT NOTE: with my Windows 11 I had a lot of issues getting 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 and, after writing the card, checking that the new “bootfs” partition, visible from your Windows PC, includes the “firstrun.sh” file into the root folder. Otherwise, please wait for it to appear before ejecting the card at the end of the flashing operations!

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.

imager-raspberry-pi-os-lite-success-write

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

IMPORTANT NOTE: as of the “firstrun.sh” file issue, this method could not work at the date (May, 2023) in some Windows versions.

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

Download the 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 into your PC/SD card reader.

Run Etcher on your PC.

etcher-home

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

etcher-raspberry-pi-os-lite

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

etcher-raspberry-pi-os-lite-success-write

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-lite-boot-partition

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 the 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-untitled

Go to: File -> Save as

notepad-save-as

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.

In 2022, the Raspberry PI Foundation removed the default “pi” user with the password “raspberry” because of security problems with 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

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

Updating Raspberry PI OS Lite

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 -y && sudo apt upgrade -y

The “&&” symbol links two different commands in one line so that the upgrade operations will automatically follow the update ones.

Next Steps: Advanced Configurations

After finishing the Raspberry PI OS Lite installation, you may need advanced configurations available from the following links:

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: 20

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?