Introduction to the Raspberry Pi
What is a 'headless' operating system?
In this project you will be using Raspbian Lite which, as you know, is a Linux-based operating system with no graphical user interface and only the bare-minimum software pre-installed.
In addition, you will setup your Raspberry Pi Zero W without a monitor, keyboard or mouse.
The only cable you will connect to it is the mini-USB power cable.
This type of setup is known as “headless”.
A headless computer is on that is configured without the typical input and output interfaces (monitor, keyboard, mouse). A user will interact with a headless computer through a network interface and a separate, client computer.
In this project, you will setup your regular work computer with a terminal program, like Putty, iTerm or the Windows Console and the SSH (Secure SHell) protocol to connect to your Raspberry Pi via your Wifi network.
You will issue text commands on the command line, as in the example in the screenshot below.
There are a few more differences between a headless computer system and a GUI-based one that I want to highlight.
I have summarised these differences in this Table :
No monitor, mouse, keyboard.
Requires monitor, mouse, keyboard.
OS occupies much less disk space.
OS is larger to accommodate for the graphical components and applications.
Operated using a separate computer via a remote connection.
Can be operated directly, no need for separate computer.
Best for server or remote applications.
Best for desktop applications.
Faster to backup and update (due to its smaller footprint).
Longer to backup and update (due to its larger footprint).
Improved reliability (fewer things to break).
Acceptable reliability for desktop use.
Improved performance that is memory-bound, RAM is dedicated to applications.
RAM has to be shared with video and applications.
User must be familiar with the command line.
User can use point and click interface.
Apart from those differences I have already mentioned, the table a few additional yet just as important ones.
A headless operating system without GUI components and applications has a very small footprint on the disk. This means that maintenance and backup/restore operations are faster simply because there are fewer bytes to work with. In this project I will show you how to backup and restore your work stored on the SD Card. Backing up an 8GByte SD Card (which can easily accommodate Raspbian Lite) take half the amount of time that you need for the same thing when you use a 16GByte SD Card (which is the smallest recommended size for the full Raspbian).
Another advantage is reliability. Headless computers typically run minimal operating systems so that the risk software bugs and conflicts between services is minimised. Those computers can run for years without a reboot, reliably servicing end user requests. This is impossible to ask from a full desktop operating system. Even the best of those must be restarted regularly.
In this project, you will create an application that operates as an automated service, reliably, non-stop, for ever.
My Raspberry Pi 1 is still running the original Full Stack application and Raspbian Wheezy (the first version of Raspbian from 2013) since 2014. I admit that I had to restart it a few times due to power outages. The longest uninterrupted stretch was 9 months, which is amazing.
Another advantage of headless computers and Lite operating systems is performance. A regular GUI operating systems contains hundreds of background services that are constantly running. These services do things such as checking for mouse of keyboard events, redraw the screen and handle user notifications.
All these things take up valuable CPU and memory resources. In a computer like a modern PC with multiple CPU cores and lots of RAM, this is not a big consideration. After all, these computers are designed for GUI interfaces from the ground up. However, for a Raspberry Pi Zero, with a single processing core and 512MB RAM, useless services quickly become a performance bottleneck. A Lite and headless operation released resources that we can better used to develop and operate our web application.
"Raspberry Pi Getting Started" series
Ready for some serious learning?
Start right now with Raspberry Pi Full Stack - Raspbian
This is our most popular Raspberry Pi course & eBook.
This course is a hands-on project designed to teach you how to build an Internet-of-Things application based on the world’s most popular embedded computer.
You will learn how to build this application from the ground up, and gain experience and knowledge with technologies such as...
- The Linux operating system and the command line,
- The Python programming language,
- The Raspberry Pi General Purpose Input Output pins (GPIOs),
- The Nginx web server,
- The Flask Python web application microframework,
- JQuery and CSS for creating user interfaces,
- How to deal with timezones,
- How to create charts with Plotly and Google Charts,
- How to do datalogging with Google Sheet,
- How to create applets with IFTTT,
- How to secure your application with SSL.
Jump to another article in this series.