In this guide we’ll see how to install DietPi, ultra light Debian based OS, on Raspberry Pi zero W with a simple step by step guide.
Raspberry Pi comes with the most famous OS directly developed to fit perfectly with those Single Board Computers: 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.
What is DietPi?
DietPi is one of lightest OS available for Raspberry PI, based on Debian. 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.
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.
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 if you experience 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
Because Raspberry Pi Zero hasn’t ethernet port, 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)