How to install DietPi minimal image on RPi Zero 2 W and configure SSH access via Wi-Fi

dietpi

This tutorial aims to serve as a guide for anyone who wants to use the Raspberry Pi with a lightweight OS, such as DietPi using an SSH connection.

Nowadays, single board computers have gained more and more enthusiasts. Subsequently, it has become more and more versatile.
Since setting up a single board computer can take some time, either to set it up as a server or simply to perform simple tasks (such as running a script). That’s why DietPi was born, which is a minimal Debian-based Linux distribution highly optimized for single board computers.
This tool can simplify the configuration of a Raspberry Pi, for example, in order to make the most of its hardware.

Parts Required

  • Raspberry Pi Zero 2 W (or similar);
  • Micro-USB cable;
  • MicroSD at least 4GB;
  • A way that makes it possible to write to the MicroSD, using the computer (external card reader or integrated slot);
  • 7-Zip;
  • balenaEtcher.

Obtain and unzip DietPi image

1. Access to dietpi.com.

2. Go to the download section.

3. Click on “Raspberry Pi“.

4. Choose “ARMv8 64-bit image“.

5. When the download is complete, extract the files to a chosen location.

Write the DietPi image on MicroSD card

1. Download and install balenaEtcher. It is not mandatory to use balenaEtcher. If you are familiarized or prefer with another tool like Rufus you can use it.

This image has an empty alt attribute; its file name is image-10-1024x583.png

2. After inserting the MicroSD card on your computer, start the balenaEtcher.

3. Find and choose the correct DietPi image that you want to flash the MicroSD.

4. Make sure that the correct “drive” is selected.

5. After that advance and flash the MicroSD card. Keep in mind that this process may take some time.

Setting up a connection to a Wi-Fi network

1. In order to configure the Wi-Fi connection, you need to access the drive E: (in this case). Usually is the drive that the space is recognized by the file explorer of the Windows, in this case, because partition E: and F: belong to the MicroSD card used.

2. Open the file “dietpi.txt” with Notepad++ or another text editor that you are familiarized. Search for “AUTO_SETUP_NET_WIFI_ENABLED” and set the value to “1“. Save the changes and close the file.

Example of “AUTO_SETUP_NET_WIFI_ENABLED” set to “1“.

Note: If you want to use a static IP you need to change the value of “AUTO_SETUP_NET_USESTATIC” to “1” and change to desired values ‚Äč‚Äčthat satisfy the conditions of your local network, of the following variables: “AUTO_SETUP_NET_STATIC_IP“, “AUTO_SETUP_NET_STATIC_MASK“, “AUTO_SETUP_NET_STATIC_GATEWAY“, “AUTO_SETUP_NET_STATIC_DNS“.

Location of information regarding network settings that must be changed to set a static IP.

3. Open the file “dietpi-wifi.txt” on the same text editor.

4. On “dietpi-wifi.txt“, search for “aWIFI_SSID[0]” and set the value to the name of your WIFI network.

5. On the same file, search for “aWIFI_KEY[0]” and set the value to the password of your WIFI network.

Accessing Raspberry Pi via SSH and first login on DietPi

Note 1: If you do not use the hotspot or static IP address, you need to check on your router the IP address for the Raspberry Pi (for example). If that is the case, skip step 2.

Note 2: If you configured a static IP address you can jump step 2 and on step 3 use the static IP address.

1. After inserting the MicroSD card on the Raspberry Pi, connect the Raspberry Pi to a power supply.

2. In this case is used a hotspot network from the laptop. Consequently, go to the mobile hotspot definition on Windows 10 to check the IP address from your Raspberry Pi.

3. Initiate Putty or another tool to establish an SSH connection and put the IP address from your Raspberry Pi. When the “Putty Security Alertwindow appears, choose “Yes” to proceed.

4. After it will appear a login prompt. On login use “root” and the password is “dietpi“.

5. To advance you need to accept the DietPi GPL license.

6. After that the DietPi will automatically look for updated folders and start installing them. Do not be surprised if this process takes some time to complete.

7. When the updates finish the DietPi will ask if you want to change your credentials. It is at your discretion if you want to do it, this is not mandatory.

Note: If you do not want to change them now, you can do this process later. Just type “passwd” on the terminal. Another way to change it is through the command line to access “dietpi-config“.

Example of what happens when you do not want to change the credentials.

8. After that, the “DietPi-Software” should appear. From here you can search for and install the software you want to use on the Raspberry Pi (like Docker, Python, Xfce desktop, and others).

9. If you want to finish the minimal image installation, select “GO >> Start installation for selected software” and press “Enter“.

10. Then DietPi will ask if you want to send usage data.

11. If all goes well, your PuTTY terminal should look like this.

Conclusion

Whether you want to use a graphical interface or not, DietPi makes the process easy, as you can install just what you want from the beginning. Thus allowing you to increase the use, for the maximum possible of the hardware that you intend to use.

References

[1] https://dietpi.com/

[2] https://dietpi.com/docs/install/

[3] https://dietpi.com/docs/software/

Leave a Reply

Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!

Hello! We have noticed you are using an ad blocker. Our website is funded by advertising which allows you to access all our content for free. By disabling your ad blocker, you are contributing to the sustainability of our project and ensuring we continue to provide high-quality, useful tutorials. We appreciate your support!