Raspberry Pi comes with the most famous OS directly developed to fit perfectly with it: Raspbian (see here for the complete guide). Even if Raspbian performs fine, there are also many other linux forks able to open new perspectives. In my opinion one of the most appealing is DietPi. As the same name says, DietPI comes with a very small default image: about 90MB (compressed) and 630MB (extracted). However, this comes with a few feature rich programs and all of needed tools to use at the best our Raspberry Pi.
What is DietPi?
DietPi is one of lightest OS available for Raspberry PI, based on Debian. It can also be used with a number of alternative SBC (Single Board Computer), having available for download about 30 hardware based images). DietPi is compatible with armv7l, armv6l, aarch64 and x86_64 architectures. It has very low resources needs, so that you can test it also with very old hardware. Recently I noticed they added also images for virtual environments. This way you can test DietPi also on a virtual system like vmware ESX, VirtualBox or Microsoft Hyper-V.
As said, its image starts from a thrifty 400MB sized, that is about 3x lighter than Raspbian Lite. It is already optimized to use the less RAM and CPU possible, but includes powerful programs able to setup services with a few clicks.
I stronghly recommend DietPi for all people who want to start micro-server projects with SBC hardware. It enables you to start from minimal image (without Desktop Environment) and add features as you need with the simple command “dietpi-software”. This way you can install only your preferred desktop environment and your favourite software to have services running with a simple (but rich) list selection.
Last but not least, it has a useful installation procedure able to automatize and simplify first boot settings.
In order to test te power of this distro, today I decided to install DietPI on my Rasperry Pi Zero W. DietPi also comes pre-installed with Dropbear SSH Server, so for first installation we’ll need only to assure WiFi connection if we don’t want to connect it to a monitor. To install DietPi on Raspberry Pi zero W we are using a Windows PC with Balena Etcher preinstalled.
What We Need
Please find below hardware list:
I suggest adding to your shopping chart all needed hardware, so that at the end you will be able to evaluate overall costs and decide if continuing with the project or removing them from shopping chart.
Step 1: flash OS image to SD card
Download image from official download page and unzip it.
Insert your SD card in your PC/SD card reader.
Run Etcher in you PC (use Run as Administrator to avoid experiencing problems).
Click “Select Image” and select DietPi disk image previously downloaded. Now Etcher should also have recognised your SD card. Otherwise, click change and select correct SD card.
Click Flash and wait the operation to be successfully completed.
Close the window, extract and insert again the Sd card.
Step 2: preconfigure WiFi
Raspberry Pi Zero W hasn’t ethernet port, so a WiFi preceonfigured could be useful to have it ready at first boot with WiFi connection already up. In this DietPi extremely simplify operation even better than original Raspbian. We need only to open the boot partition and edit the followiong 2 files.
In dietpi.txt enable WiFi by setting:
In dietpi-wifi.txt configure and save your WiFi connection by setting the correct parameters in:
Now you can safely eject your SD card.
Step 3: boot
Insert SD Card into your Raspberry and boot it. Identify the IP assigned, maybe controlling your router DHCP records. Wait for DietPi to complete the filesystem expansion (this will automatically reboot your device).
Connect via SSH to your Raspberry, with the following default credentials:
At the first login, DietPi asks you to accept the GNU General Public License terms:
Press TAB then Return on “OK”.
DietPi also asks you if you want to participate to DietPi-Survey and asks permission to collect some not-private data.
Select at your choose and press OK.
Finally, after having updates system, DietPi asks to reboot to complete setup. Press OK.
Login again via SSH. DietPI now guides you through some basic but important settings:
- change the default global password (press ok and hen insert twice the new password):
- change the root and dietpi password (press ok and hen insert twice the new password):
- disable or leave enabled the serial console (I suggest to leave it on, so click Cancel)
- the default DietPI config screen now appears, which allows us to select more software to enrich our installation. In the simpler case you can scroll down to select “Install” and proceed with a minimal installation.
This will definitely complete DitePi setup.
At this point you have a very fast minimal server where you can use tipical Debian commands (for example apt-get) or use special feature rich programs like, for example:
- dietpi-config: for device configuration
- dietpi-software: to select optimized software for installation (see here for a complete list)