Skip to content

Set Up Raspberry OS and Install Pi-hole

  1. Insert a microSD card, then Open SD Card Formatter and choose the card from the Select card dropdown.
  2. Select Format to format the card.
    • The default settings are fine: Quick format and no volume label.

Raspberry Pi Imager makes the SD card a bootable drive.

  1. Open Raspberry Pi Imager
  2. Choose Device: Raspberry Pi 4
  3. Choose OS: Raspberry Pi OS (64-bit)
  4. Choose Storage to select the SD card
  5. Next
  1. In the Use OS customisation? popup that appears, select EDIT SETTINGS. If the device you’re using is connected to Wi-Fi, a prompt will ask if you’d like to use the Wi-Fi password from the system pre-filled in the Customisation screen. If you don’t pre-fill it, you can still enter it on the next screen.

    Raspberry Pi Imager OS Customisation window with all options checked in the General tab.

  2. In the GENERAL tab, make your selections. Use your own easy-to-remember username and password:

    • ☑ Set hostname: pi-hole.local
    • ☑ Set username and password
      • ☑ Username: probablyedward
      • ☑ Password: probablyhunter2
    • ☑ Configure wireless LAN (only if you’re not using Ethernet)
    • Set locale settings
  3. In the SERVICES tab:

    • ☑ Enable SSH and ☑ Use password authentication
  4. In the OPTIONS tab:

    • Uncheck Enable telemetry
  5. Select Save

  6. When the write completes, remove the SD card from your computer and insert it into the Raspberry Pi. Plug in the Pi and give it a few minutes to load.

If you configured Wi-Fi and plugged the Pi in via Ethernet, your Pi will have two IP addresses. To make it easier to enable network-wide blocking later, identify the Pi’s Ethernet IP address.

For me, I use a TP-Link Omada controller:

  1. Log in and select the site’s name.
  2. Select Clients then Wired to filter the table of connected clients.
  3. Select pi-hole in the USERNAME column to open the Details sidebar.
  4. Select Config and check ☑ Use Fixed IP Address.
If you skipped to this section, expand this for things to look out for.

If you installed Pi-hole on an existing device or skipped to this section

OS-specific things that might be different for your setup:

  • Installed software like Git, curl, or zsh
  • apt package manager. Your OS might use a different one.
  • User accounts. The examples I use are probablyedward and pi

Replace the username, probablyedward, and example IP, 192.0.2.25, in these steps with your Pi’s username and local IP.

  1. Open your terminal app and SSH to the Pi:

    Terminal window
    ssh probablyedward@192.0.2.25

    Enter the password when prompted.

  2. Update the system and install dependencies:

    Terminal window
    sudo apt update && sudo apt upgrade -y
    sudo apt install git php-cli php-sqlite3 php-intl php-curl unbound

    Enter the password when prompted. This is the point at which I also configure my command line interface (CLI) and editor, but that’s outside the scope of this doc.

  3. Run the Pi-hole installation script:

    Terminal window
    curl -sSL https://install.pi-hole.net | bash
  4. The script will prompt you with a number of warnings and options. When prompted select:

    • Choose An Interface: eth0 for Ethernet.
    • Static IP Address: Yes and enter the IP address you found in Find the Pi’s IP Address.
      • Unless you’ve made specific changes to the network, the gateway address should be the IP of the router or controller. In this example, that’s 192.0.2.1.
    • Upstream DNS Provider: Select Cloudflare for now. This is a setting we’ll change later, but we select Cloudflare’s DNS server now so that every DNS request from the Pi going forward will be routed through a trusted directory.
    • Blocklists: Yes to use the default list.
    • Admin Web Interface: Yes to install the Pi-hole web interface.
      • Web Server: Yes to install lightppd for the web interface.
    • Enable Logging: Yes to enable query logging. This helps diagnose issues like when Hulu or Disney+ won’t load on your smart TV.
      • Select a privacy mode: 0 to show what site got blocked on which device. Consult the official Pi-hole docs for more information about the privacy levels.

    The last screen lists the IP and a temporary password for the Pi-hole web interface. Since we’ll change it in the next step, it’s safe to ignore this.

  5. Change the temporary password. Change the examplePassword in this example:

    Terminal window
    pihole -a -p examplePassword
  6. Optional: Follow the steps in the official Pi-hole documentation to configure unbound.

    This step is optional because the Pi-hole is already configured to use Cloudflare’s DNS provider. Use unbound if you prefer a recursive DNS server.

  7. Log in to the Pi-hole web interface: http://pi.hole/admin.