How to Install DietPi on Your Raspberry Pi

Ben Ben (11)
15 minutes

If you need a resource-light operating system for your Raspberry Pi, then you should consider trying DietPi. This Debian-based alternative to the official Raspbian operating system is optimized to have the smallest footprint on your system resources as possible, making it a great option for older Raspberry Pis.

It offers a similar user experience to Raspbian and, as they’re both Debian-based systems, you can install software packages that should work across both platforms, meaning you can use your favorite software in Raspbian or DietPi.

DietPi can also be used to quickly install different software configurations, from media centers to web servers and more. If you’ve installed Raspbian before, then installing DietPi shouldn’t be too unfamiliar an experience. Here’s what you’ll need to do to install DietPi on any model of Raspberry Pi.

Raspberry PiRaspberry Pi ×1

Howchoo is reader-supported. As an Amazon Associate, we may earn a small affiliate commission at no cost to you when you buy through our links.

To start, you’ll need to download the image file for the latest version of DietPi. This is the file you’ll use to flash DietPi to your Raspberry Pi’s microSD card. You can download this from the DietPi website, underneath the Raspberry Pi section.

DietPi Installer Page

Unlike Raspbian, which has a Lite and Standard version, there’s only one version of DietPi available—this will work for all Raspberry Pi models. You can decide which graphical desktop environment (if any) to install after you’ve flashed your microSD card.

The DietPi image file is compressed, making it a much smaller file to download. You’ll need to extract the image file to be able to flash it to your microSD card. The compressed file is in the 7z file format, so the methods for extracting this will vary, depending on your operating system.

Extracting DietPi on Windows

Windows users will need to download and install 7-Zip to extract this file first.

Once 7-Zip is installed, right-click the compressed file in Windows File Explorer and, under the 7-Zip menu, click the Extract to option to extract the image file to a new folder.

Windows 7zip extract

Extracting DietPi on Linux

Linux users will need to download and install p7zip, the terminal version of 7zip, to do this.

On Debian and Ubuntu-based systems, open a terminal and type:

sudo apt install p7zip-full

Once p7zip is installed, type the following at the terminal to extract the file:

7za e DietPi.7z

Replace DietPi.7z with the correct name of your compressed DietPi file. This will extract the DietPi image file for you to use.

Linux p7zip extract

Extracting DietPi on macOS

No additional software is required to extract 7z files on macOS. Once the compressed DietPi file has downloaded, open the Finder app and double-click the compressed DietPi file.

macOS Finder 7zip extract

The Archive Utility app on macOS will automatically extract this file and place the contents in a new folder.

Once your DietPi image file has been extracted, you can use the Raspberry Pi Imager to flash it to your microSD card (or SD card for older Raspberry Pi models). This will wipe the card and replace the contents with DietPi, so be sure to back up any existing files before you begin.

This tool allows you to automatically download and flash Raspbian, Ubuntu, and LibreELEC distributions to your microSD card, but it can also be used to flash other image files, including DietPi’s own.

Raspberry Pi Imager

The Raspberry Pi Imager is available for use on Windows, macOS, and Linux, and is available for download from the Raspberry Pi Foundation website. These steps should be the same across all platforms.

  1. Before you begin, place your Raspberry Pi’s microSD card (or SD card for older models) into a suitable SD card reader and connect it to your PC. Once you’re ready to begin, open the Raspberry Pi Imager and press the Choose OS button.
  2. In the Operating System selection window, scroll down and click the Use Custom option.
  3. Select the DietPi image file (in the img file format) that you previously extracted.
  4. Once the file is selected, click the Choose SD Card button and select your connected microSD card.
  5. Click Write to begin flashing DietPi to your Raspberry Pi’s microSD card. This process will take a little bit of time to complete, depending on your PC.

Once the Raspberry Pi Imager has finished flashing your microSD card, you can safely close it and remove your card.

If you plan on using your Raspberry Pi headless (without a monitor), then you’ll need to enable SSH on your Pi to be able to connect and control it remotely before removing your microSD card and placing it in your Raspberry Pi.

To do this, add a file named ssh to the boot folder on your microSD card. This will instruct DietPi to enable SSH access when it first boots up.

DietPi boot folder

If you’re not using an ethernet connection, you’ll also need to configure the Wi-Fi connection on your Pi at this stage. You can do this by changing the following setting in the dietpi.txt file inside your boot folder to the following:

AUTO_SETUP_NET_WIFI_ENABLED=1

With that setting enabled, open the dietpi-wifi.txt file in your boot folder and add:

aWIFI_SSID[0]='SSID'
aWIFI_KEY[0]='WifiKey'

Replace SSID with the name of your Wi-Fi network and WiFiKey with the password to your Wi=Fi network. Once the settings have been changed, insert your microSD card into your Raspberry Pi.

You can change these settings later using the DietPi-Settings (for SSH access) and DietPi-Config (for WiFi connectivity) tools.

With the DietPi image file flashed to your microSD card, you’re ready to insert it into your Raspberry Pi, connect all of your peripherals, and boot it up.

DietPi isn’t packaged with a graphical desktop environment by default, so you’ll be presented with a terminal console as soon as DietPi finishes the boot-up process. You’ll need to use the default DietPi username (root) and password (dietpi) to sign in at this stage, but you’ll be able to change these later.

If you’ve enabled SSH access and can connect to your Pi remotely, you can connect via SSH and log in using the default username and password.

When DietPi first boots, it will run through some initial configuration stages to update any initially installed software packages, change the default passwords, and enable or disable certain elements of the Raspberry Pi hardware.

  1. You’ll need to accept the DietPi GPL license first—hit the enter key on your keyboard to do this.
  2. DietPi will then immediately begin to search for and install updated software packages, which will take some time to complete. Once the packages have been updated, DietPi will ask you to confirm whether or not you’d like to enable user analytics. Use your keyboard to select one of the options to opt-in or opt-out, then hit enter on your keyboard to confirm.
    DietPi initial configuration
  3. You’ll be asked to set a global password for software installations. Select OK and provide a new password (you’ll need to provide it twice), then hit enter on your keyboard to confirm.
  4. The default DietPi password is insecure, so you’ll be asked to change this at the next stage for both the root and dietpi user accounts. Select OK and hit enter, then provide your password (twice) to confirm. You can change this again later by typing passwd at the terminal.
    DietPi password change
  5. DietPi will ask you if you’d like to enable serial access, which you might like to use if you’re connecting devices to your Raspberry Pi’s GPIO pins. Select OK to enable this, or Cancel to leave it disabled.

Once the initial configuration stages are complete, DietPi will launch the DietPi-Software tool. This allows you to run an additional tool (DietPi-Config) to change your Raspberry Pi settings further, as well as install the software you wish to use on your Pi.

  1. Select DietPi-Config in the DietPi-Software options list to begin.
    DietPi config
  2. This will give you an overview of your display, audio, language, and software options for your Raspberry Pi. For instance, if you want to overclock your Pi, head to the Performance Options menu.
  3. If you want to set up a new Wi-Fi connection, select Network Options: Adapters and choose WiFi or Onboard WiFi to set it up.

While the Raspbian raspi-config tool allows you to enable or disable SSH access, you’ll need to do this using the DietPi-Software tool, under the SSH Server menu.

The base installation of DietPi is minimal by design, allowing you to choose what software you want to install and use using the DietPi-Software tool. If you’re unsure what software to install, a list of common DietPi software options is available at the DietPi forums.

This tool will automatically launch when you first boot your Raspberry Pi using DietPi after the initial configuration process has completed, but you can launch it manually by typing dietpi-software at the terminal.

  1. To begin, select Software Optimized in the main DietPi-Software menu list and hit enter.
    DietPi software optimized
  2. Scroll through the list of available software using your keyboard arrow keys. These are separated into categories (for instance, desktop for desktop environments like LXDE, media systems for media players like Kodi, etc).
  3. To install software on your DietPi, select it in the list and press the space bar to add it to the installation list. If you change your mind, hit space again to remove it.
    DietPi selected software install
  4. Once you’ve selected the software you wish to install, press the tab key on your keyboard to switch to the confirmation options at the bottom. Select OK, then hit enter on your keyboard to confirm.
  5. If you can’t find the software you want to install in that list, select Software Additional to choose from a wider list, or Search to search for it manually in the main DietPi-Software menu list.
  6. To begin installing your software, select Install from the main DietPi-Software menu list, then hit the enter key. DietPi will ask you to confirm your choices—select OK, then hit enter to begin the installation.
    DietPi begin software install

The software you selected will begin to install at this point. Once the process is complete, you may be asked to restart your device—press OK to confirm. You can return to the DietPi-Software tool to make further changes at any time by typing dietpi-software at the terminal.

By default, DietPi will boot to a terminal window. If you install a desktop environment, you’ll be asked if you’d prefer to change this to your graphical desktop environment. You can also change this to other full-screen software like Kodi instead.

  1. To set this manually, launch the DietPi-Config tool at the terminal and select the AutoStart option. You can access the autostart menu directly by typing dietpi-autostart at the terminal.
  2. In the autostart menu, select your preferred boot-up environment. For instance, to boot to a desktop environment, select one of the options listed under the Desktops category and press the enter key on your keyboard.
    DietPi boot-up options
  3. With your boot-up option selected, press the tab key to switch to the confirmation options at the bottom and select Exit to exit the menu.

With your system updated, your chosen software installed, and your boot-up options changed, you can begin using your DietPi installation as intended. If you’re struggling for ideas on how to use your Pi, there are plenty of Raspberry Pi projects you can try with DietPi at the center.

If you want to make further changes to your DietPi configuration, you can run DietPi-Launcher at the terminal to view other DietPi tools, including DietPi-Update to update your device and DietPi-Backup to back up your device.

Thanks to the DietPi-Software configuration tool, switching between different projects is easy—just run the tool again to install a new set of software packages.

John John (304)
15 minutes

Important: Raspbian has been replaced by Raspberry Pi OS! Raspbian is a free Debian-based operating system optimized for Raspberry Pi hardware. "Buster" is development code name for Debian 10.