How to Install DietPi on a Raspberry Pi (Complete Guide)

DietPi is a lightweight Linux distribution for the Raspberry Pi. It is designed to be lightweight and easy to use, while still providing a full range of features. This guide will show you how to install DietPi on your Raspberry Pi.

1. Download DietPi

The first step is to download the DietPi image from the official website. You can find the download link on the DietPi homepage. Once you have downloaded the image, you will need to unzip it.

2. Write the Image to an SD Card

Once you have unzipped the image, you will need to write it to an SD card. You can do this using a program such as Etcher. Insert your SD card into your computer and open Etcher. Select the DietPi image and the SD card you want to write it to, then click “Flash”.

3. Boot the Raspberry Pi

Once the image has been written to the SD card, you can insert it into your Raspberry Pi and boot it up. When the Raspberry Pi boots, it will automatically start the DietPi setup process.

4. Configure DietPi

The DietPi setup process will guide you through the configuration of your Raspberry Pi. You will be asked to set up a username and password, as well as configure the network settings. Once you have finished the setup process, you will be ready to start using DietPi.

5. Install Software

DietPi comes with a range of software pre-installed, but you can also install additional software. To do this, open the DietPi-Software menu and select the software you want to install. DietPi will then download and install the software for you.

That’s it! You have now successfully installed DietPi on your Raspberry Pi. You can now start using it to create projects and explore the world of Raspberry Pi.

I was looking for other distributions to try on my Raspberry Pi, and among all the failures I found DietPi, which seemed interesting. I tried it out and was very impressed. It’s the perfect distribution for my Raspberry Pi Zero (or other models). So today I’ll share with you what I have learned.

DietPi has a version available for any Raspberry Pi model. After downloading the image, it can be flashed on a new SD card by using Balena Etcher. A wizard will even guide you on the first boot to complete the installation.

Today, I will share a step-by-step guide on DietPi, including a DietPi presentation, the installation process and a few tips to get started.

If you’re looking to quickly progress on Raspberry Pi, you can check out my e-book here. It’s a 30-day challenge where you learn one new thing every day until you become a Raspberry Pi expert. The first third of the book teaches you the basics, but the following chapters include projects you can try on your own.

What is DietPi?

DietPi introduction

As its name suggests, DietPi is a lightweight distribution for your Pi. It’s based on Debian and you can configure it to start with a minimal operating system (less than 200M once installed).

It’s highly optimized for minimal CPU and RAM hardware, so it’s perfect for a Raspberry Pi Zero, but you can use it on any operating system.

You start with a minimal system and can choose to install additional software or not (even a desktop environment if you want).

If you want to give it a try, it’s even possible to use it on a standard PC or a VM (images available on the official website).

The DietPi Story

It seems that DietPi has been around since 2015 (I couldn’t find clear information, but this is the forum creation date). As you may not yet know what DietPi is, here are the main links you can browse to learn more about this distribution:

If you still think that DietPi is an interesting distribution to try, let’s move further to learn more :).

Why DietPi rather than Raspberry Pi OS Lite?

As it’s based on Debian, DietPi is close to Raspberry Pi OS Lite, so you might ask yourself why you’d need to choose one or the other.

The first thing to note is that DietPi is updated often. For example, it’s upgraded to the latest version of Debian way faster than Raspberry Pi OS.

To give you a quick overview of the optimizations you can get, here is a short performance comparison I made between DietPi and Raspberry Pi OS Lite:

DietPi Raspberry Pi OS Lite
Image Size 889 MB 1780 MB
SD Card usage 0.7 GB 1.2 GB
Minimal memory usage 53 MB 110 MB
Bootup Time 14 s 15 s
Packages installed by default 238 463

These values are for a fresh new install, with nothing more than the default packages, so you might need to compare them in your specific environment. And, it’s the same result for most of the indicators (processes, swap usage, etc.).

So for a basic installation, DietPi is really a good choice. It’s up-to-date and easy to use (same commands as Raspberry Pi OS most of the time).

How to install DietPi on a Raspberry Pi

Here are the required steps to install DietPi on your Raspberry Pi:

  • Download the image from the official website.
  • Extract the file from the archive and flash it to your SD card.
  • Insert it into your Raspberry Pi and follow the instructions.

Let’s see how to do each step in detail.

Download the DietPi Image

Like for any OS, you need a few prerequisites to follow this tutorial.

Here is a list of hardware you need to prepare:

  • A Raspberry Pi (the Zero seems perfect for DietPi, but any model is fine).
    You can find my latest recommendations here if needed.
  • A minimal SD card, let’s say at least 4G (so any new one is OK), and a way to read it on your computer (integrated slot or external SD card reader).

That’s all you need.

A screen, mouse or keyboard is not mandatory if you have a computer and follow all the steps I’ll give you (we’ll connect remotely).

For the software, just two things are needed:

  • The latest DietPi image that is available on the official website.
    Select “Download” in the main menu, choose Raspberry Pi and click on the download button (sorry, no direct link is available).

    Make sure to pick the one corresponding to your Raspberry Pi model. If you have a recent model, you can download the 64-bit image for increased performance.
  • Then download Balena Etcher, which is my favorite to flash an SD card for Raspberry Pi.
    Etcher is available for Windows, Linux and macOS. Just click on the download button from your computer.
    Free download here.
    You can also use Raspberry Pi Imager if you prefer (DietPi is not on the OS list, but you can flash a custom image with it).

That’s it, you are ready to start!

Flash the DietPi Image to an SD Card

The first step is to prepare the SD card with DietPi.
I use Etcher to do this, but if you prefer another software, it’s your choice.

Note: DietPi is one of the rare distributions delivered as a 7zip archive. You need to extract the image manually before going further. It seems that Balena Etcher does not support this file format (you can download 7zip here if needed).

  • Open Balena Etcher.
  • A window like this shows up:
    etcher menu
  • Click on the first button, and browse to DietPi image location.
    Select it and continue.
  • Insert your SD card into your computer, and Etcher will detect it automatically.
    You can ignore your system messages about this SD card.
    It also works fine with a USB drive if you prefer.
  • Finally, click on “Flash!” to start the copy on the media.

After a few minutes, the SD card is ready. Eject it.

Configure the Wi-Fi Before the First Boot

If you want to use a wireless connection, especially if you don’t have a screen, you must configure it before the first boot.

So if you are trying DietPi on a Raspberry Pi Zero, follow these steps:

  • Insert the SD card back into your computer.
  • Go to the boot partition in your file explorer.
  • Find the dietpi.txt file, you’ll need to change one thing in order to enable auto Wi-Fi connection:
    • Open the file with your favorite editor.
    • Find the line starting with “AUTO_SETUP_NET_WIFI_ENABLED” and set it to:
      AUTO_SETUP_NET_WIFI_ENABLED=1
      This will enable the wireless connection on boot. The SSID and password are in another file.
    • You can also quickly check this file to change any settings you want directly here (keyboard layout, time zone, network configuration, hostname, etc.).
    • If you don’t have a DHCP on your network, the network configuration is mandatory in order to use it without a screen.
      But nothing else is required, you can do this later (I’ll show you).
    • Save and exit.
  • Now, find the dietpi-wifi.txt file and open it.
    • Here is what you’re looking for:
      dietpi wifi configuration
      It’s at the beginning of the file, with all the fields you need to configure your wireless connection.
    • Fill in at least the SSID and KEY variables, if you have a basic network with WPA-PSK.
      The other fields are for highly secured networks, such as in companies.
    • Save and exit.
  • Make sure you close all the files and eject the SD card again.

This time it’s good. We are ready to start the Raspberry Pi.

Start DietPi for the First Time

Insert the SD card or plug the USB drive into your Raspberry Pi and start it.
A few seconds later, you will be able to connect through SSH or follow the instructions on the screen.

Connect to DietPi via SSH

If you want to connect via SSH (recommended):

  • Find the IP address of the Raspberry Pi.
    You can scan your network or check the computer list on your router (probably your Internet box).
    If you don’t know how, check this tutorial on how to find your Pi IP address.
  • Once you find it, you can connect with an SSH client (SSH is enabled by default).
    On Linux and macOS, it’s available directly in the terminal: ssh user@IP.
    On Windows, you can install software, like Putty (download here). But on the latest versions, SSH is also available natively in the command prompt.
    puTTy configuration
    Fill in the hostname with the IP address and click “Open”.

I have a full guide about SSH with a Raspberry Pi. I recommend checking it if you are a bit lost with this step.

DietPi configuration wizard

Once connected via SSH, or directly on the screen, here are the default DietPi login and password:

  • Login: root
  • Password: dietpi

Once logged in, DietPi will complete a few preparation steps for you and a wizard shows up to help you with the configuration process. For example, the system updates are done automatically on first login and then the system reboots to apply changes (if the network is available).

Yes, we probably need this on Raspberry Pi OS Lite for beginners.
A wizard will the guide you to complete the installation:

  • It will ask you a few questions for the basic steps:
    • The passwords you want to use for DietPi users (recommended).
    • Disable the serial console if not needed (probably the case).
  • Then you get a complete wizard to configure the system and install new software directly from here:
    • A list of useful links to start with DietPi.
    • Everything you need for the basic configuration (DietPi-Config): Display, audio, performances, advanced options, language, security, network, auto-start and other tools!
    • A few lines to search and install new services and applications.
      You can also browse a list of recommended packages to install:

      You can even install your favorite desktop environment from here, with an easy-to-use checklist.
      Use the arrows to highlight one line, and space to check/uncheck one application.
    • Configure your favorite services for the main servers you want to use (SSH, File server, Web server, etc.).
    • Location of the home folder.
    • Once you’ve completed any changes you want, click on “Install” to install everything you selected.
      You can always do this later with the dietpi-software command.
  • You can also make no changes for now, and click “Ok” to close this wizard and keep a minimal image (or apply the changes you made). You can do everything later, including installing a desktop environment on a lite version.

    You can always use APT later to install any package manually, as on Raspberry Pi OS.

Once you confirm, the setup continues with at least the apt updates available.

It can take some time depending on the model you use and the apps you choose. But after that, you are ready to use your new DietPi system, congrats!

Are you a bit lost in the Linux command line? Check this article first for the most important commands to remember, and a free downloadable cheat sheet so you can have the commands at your fingertips.

Tips to get started with DietPi

DietPi basics

Most of the commands are the same as on Raspberry Pi OS or Debian.

If you need help with basic commands on Raspberry Pi OS/Debian, check this guide on the topic. You can even download my cheat sheet in PDF format to keep them with you all the time.

Once done, I’ll give you a few extra tips for DietPi specifically in the next paragraph.

DietPi specific commands

Here are the few commands added by DietPi to manage your system:

  • To go back to the installation wizard at any time, you can use:
    dietpi-software
  • To only see and edit the configuration part (raspi-config equivalent), use:
    dietpi-config
    Here you’ll find all the basic things you saw during the installation wizard: network, display, audio, etc.
  • To check if a new DietPi version is available for your Raspberry Pi, use:
    dietpi-update
  • Another great tool I like is to back up your DietPi system before moving to another device:
    dietpi-backup
    It allows you to save your files to a specific location, and you can choose what to include or exclude.
    And obviously, you can restore a previous backup from here :).
  • Here are the other dietpi commands you can check, if interested.
    I use them less, so I will let you try them yourself:
    • dietpi-autostart
    • dietpi-banner
    • dietpi-bugreport
    • dietpit-cleaner
    • dietpi-cron
    • dietpi-drive_manager
    • dietpi-explorer
    • dietpi-justboom
    • dietpi-launcher
    • dietpi-letsencrypt
    • dietpi-logclear
    • dietpi-morsecode
    • dietpi-process_tool
    • dietpi-services
    • dietpi-survey
    • dietpi-sync
  • I didn’t find full up-to-date documentation, so you will have to try them and see what happens :).
    Most of the time, a wizard opens to ask what you want to do if you just type the command.

Video

Want to chat with other Raspberry Pi enthusiasts? Join the community, share your current projects and ask for help directly in the forums.

Conclusion

That’s it, you know what DietPi is and how to install it on your Raspberry Pi (Zero or other models).

I really like this distribution, so I think I’ll use it more in my projects.

If you have good skills on Raspberry Pi OS Lite, it won’t change many things, except the easier installation process who is great. And then you have a lightweight distribution to do the same thing as on Raspberry Pi OS.

What do you think? If you are looking for something else, please check my top distributions for the Raspberry Pi here.

Additional Resources

Not sure where to start?
Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.
Watch the Raspberry Pi Bootcamp course now.

Master your Raspberry Pi in 30 days
Don’t want the basic stuff only? If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.
Download the e-book.

VIP Community
If you just want to hang out with me and other Raspberry Pi fans, you can also join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.
More details here.

Need help building something with Python?
Create, understand, and improve any Python script for your Raspberry Pi.
Learn the essentials step-by-step without losing time understanding useless concepts.
Get the e-book now.

You can also find all my recommendations for tools and hardware on this page.

How to Install DietPi on a Raspberry Pi (Complete Guide)

Installing DietPi on a Raspberry Pi is a great way to get the most out of your device. DietPi is a lightweight Linux distribution that is optimized for single-board computers like the Raspberry Pi. It comes with a wide range of features and is easy to install and configure.

Step 1: Download DietPi

The first step is to download the DietPi image from the official website. You can find the download link here. Once you have downloaded the image, you will need to write it to an SD card. You can use a tool like Etcher to do this.

Step 2: Boot DietPi

Once you have written the image to the SD card, you can insert it into your Raspberry Pi and power it on. DietPi will boot up and you will be presented with a setup screen. You will need to select your language, timezone, and keyboard layout. Once you have done this, you can click “Next” to continue.

Step 3: Configure DietPi

The next step is to configure DietPi. You will be presented with a list of options that you can choose from. You can select the software that you want to install, the services that you want to enable, and the settings that you want to configure. Once you have made your selections, you can click “Next” to continue.

Step 4: Install DietPi

The final step is to install DietPi. You will be presented with a confirmation screen that will show you the software and services that you have selected. Once you are happy with your selections, you can click “Install” to begin the installation process. DietPi will now be installed on your Raspberry Pi.

Conclusion

Installing DietPi on a Raspberry Pi is a great way to get the most out of your device. It is a lightweight Linux distribution that is optimized for single-board computers like the Raspberry Pi. It comes with a wide range of features and is easy to install and configure. Follow the steps outlined in this guide to get started with DietPi on your Raspberry Pi.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?