Customize your Raspberry Pi operating system for everyday use

Lighten up your Raspberry Pi even more by installing Raspberry Pi OS Lite.
185 readers like this.
Coding the Raspberry Pi in a web emulator

Opensource.com

If you have a Raspberry Pi running Raspberry Pi OS (previously known as Raspbian) operating system, you know it's an awesome little computer with a great operating system for beginners that includes just about everything you could possibly want. However, once you become familiar with the Pi and want to start using it for other things, you might want an operating system (OS) that doesn't include everything in the default build.

When that happens, you have two choices: You can pull your hair out trying to uninstall all the cruft you don't want, or you can use Raspberry Pi OS Lite to build your own custom, lightweight operating system tailored to your exact specs. I suggest saving yourself some time and aggravation and going with the latter option.

Raspberry Pi OS Lite

The "Lite" version of Raspberry Pi OS is really nothing more than a minimal image based on the latest version of Debian. This image contains only the core operating system and boots to a command line instead of a desktop. Consider this the foundation of your custom Raspberry Pi OS. Everything from here on builds on this core.

Head over to the Raspberry Pi Foundation's website and download the Lite image. After that's complete, check out the detailed installation guide covering how to burn a Raspberry Pi operating system image to an SD card using Linux, Windows, or macOS.

If you plan to use your Pi for a minimalist system to run scripts and services, you're pretty much done. If you want to do more, keep reading.

X Windows

To start, it's good to have a windowing system for the occasional time you want to connect to a Raspberry Pi with a graphical user interface (GUI).

The X Window System, sometimes referred to as X11, is a basic windowing system common on Unix computer operating systems. X11 provides the basic framework for a GUI desktop environment. It is what allows you to interact with the computer using windows, a mouse, and a keyboard.

Install X Windows

The following line will install the minimal set of packages needed to get X11 going:

sudo apt install -y --no-install-recommends xserver-xorg-core xserver-xorg xfonts-base xinit

With --no-install-recommends, only the main dependencies (the packages in the depends field) are installed. This saves a ton of space because the other recommended—but not necessarily needed—packages are not installed.

Go a step further with Xfce Desktop Environment

You could stop here and use X Windows as your desktop, if you want. However, I wouldn't recommend it. The windows manager that comes with X Windows is minimalist in a way that feels outdated. Instead, I recommend installing a modern desktop environment like Xfce, GNOME, or KDE. When it comes to microcomputers, I prefer Xfce over the others because it's designed to work well on systems with limited resources, and you can customize the way it looks via themes, icons, and more.

Install Xfce

Installing the Xfce desktop environment is super easy. Just use:

sudo apt install -y --no-install-recommends xfce4 desktop-base lightdm

That's it! You now have X Windows (X11) and Xfce installed. Now it's time to customize the environment and install some essential applications.

Essential applications

So far, you've installed X Windows (X11), the Xfce Desktop Environment, and LightDM (a display manager, added with Xfce). At this point, you have a complete, lightweight system that you can boot into and use normally. However, there are a few essential applications that I always like to install to round things out.

The following command installs a terminal app, the Audacious audio player, the Ristretto image viewer, the Mousepad text editor, the File Roller archive manager, and the Thunar volume manager:

sudo apt install -y --no-install-recommends xfce4-terminal audacious ristretto 
sudo apt install -y --no-install-recommends mousepad file-roller thunar-volman

Optional goodies

Some other goodies you might want to install are a good network manager, task manager, PDF viewer, and notification agent, as well as a wallpaper manager, screen-capture tool, some new icons, and new cursor themes. In short, these are practical additions for day-to-day usage if the Raspberry Pi will be your go-to system:

sudo apt install -y --no-install-recommends network-manager xfce4-taskmanager xfce4-notifyd
sudo apt install -y --no-install-recommends  xpdf gnome-icon-theme dmz-cursor-theme

Where to go from here?

If everything worked correctly, you now have a Raspberry Pi running a super-lightweight operating system based on Xfce 4 and Debian Lite. I suggest heading over to the Xfce website and checking out all the other cool goodies you can install and use. Where you go from there is totally up to you!

What to read next
User profile image.
Hello! I'm Patrick, and I'm a retired IT Engineer, former IBMer, Writer, Open Source advocate, Gamer, and self-proclaimed super geek. I'm also big into space technologies and exploration, UNIX, the command-line, retro consoles, and retro computers like the Atari 2600, Commodore 64, and the Amiga.

6 Comments

It would be interesting to read something about parallelism on Raspberries, since their CPUs are poli-, multi-core/thread, and easy to interconnect.

A quick heads up for folk like me who are new to using Raspberry pi, be aware that if you are using your pi via WiFi, YOU HAVE TO GO TO sudo apt raspi-config and set up your wifi connection. Otherwise, you will spend ages wondering why the script looks like it is running, but if you check it is full of errors.

But it works fine once that is sorted out.

It is hard to understand the logic of the article. If you want Raspberry Pi OS Lite - why then go on to make it a full blown graphical environment? Was hoping to see some CLI setup/config help (especially WiFi).
Just a thought.

I had a similar thought at first, arising because I am starting with "lite" for a firewall (with a TP-Link USB Ethernet dongle for the 2nd interface). I really liked how there is NOTHING listing on ANY ports by default. However, I think it is still a useful article in that it describes the concept of "knowing what you own"
- installing only what one actually needs, rather than a litany of software that one might or might not need.

In reply to by Big Dave (not verified)

Thank you for this. When setting up a server, it makes sense to keep the system as clean as possible and not have un-needed software installed. The 'Lite' form of Raspberry Pi OS is helpful here, especially if you need to advise other people on a starting point.

For internal systems, it may be better to use raspbian-ua-netinst (https://github.com/debian-pi/raspbian-ua-netinst) or one of its forks, e.g. https://github.com/FooDeas/raspberrypi-ua-netinst. These give full control over what software is installed. What is more, you can add ssh keys so that as soon as the new system boots up, you can access it using a key rather than a password.

The real power comes from being able to insert files into the new system with proper ownership and permission. As a consequence, a systemd service unit can be set up to invoke a script. In my case, the script uses run-parts to execute all the *.sh scripts in a given directory. I have used this approach in the past to install software such as mySQL-server and Webmin that require more than a simple "apt install package". The key operation is to use the post-install.txt script to create the link that would normally be created using 'systemctl enable runonce.service', e.g.

ln -s /rootfs/etc/systemd/system/runonce.service /rootfs/etc/systemd/system/multi-user.target.wants/runonce.service

If the runonce.sh script should only run on the first boot, then it can disable the service unit so that it will not be excuted again.

Standard Raspberry Pi OS still has no "run this file at boot" feature, which seems to me to be a serious omission. The approach outlined above eliminates this problem.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.