Let’s install Pi-hole on your Raspberry Pi

Image source: Freepik.com

Step 1: Setting up the directory structure

Let's get things started by firing up your terminal and ssh to your Raspberry Pi. Also, instead of typing down the IP address, you can use the following to ssh to your RPi as well.

ssh pi@raspberrypi.local
cd ../..
cd srv/dev-disk-by-uuid…
mkdir Appdata
cd Appdata/
mkdir pihole
cd pihole
mkdir dnsmasq
pwd

Step 2: Create a Pi-hole network

Using the following commands, let’s quickly create the Pi-hole network

sudo docker network create -d macvlan \
— subnet=10.x.xx.xx/24 \
— gateway=10.x.xx.xx \
-o parent=eth0 pihole_net

Step 3: Setting up the docker container

Log back into your portainer dashboard and go to the container view. From there, click on “Add container”

Add container
Name: piholeImage: pihole/pihole:latestPublish all exposed network ports to random host ports: enable
  • Volumes: first, click on map additional volume twice to add two records and add the following records.
container: /etc/piholehost: /srv/dev-disk-by-uuid…/Appdata/piholecontainer: /etc/dnsmasq.dhost: /srv/dev-disk-by-uuid…/Appdata/pihole/dnsmasq
Volume
  • Networks: Under the network tab, add the following records. IPv4 Address should be the address that you wish to deploy Pi-hole.
Network: pihole_netHostname: piholeIPv4 Address: 10.x.xx.xx
Networks
  • Env: on the Env tab, click on “Add an environment variable” thrice to add a few records as follows.
TZ: add your timezone (find it on your OMV settings)ServerIP: the IPv4 Address you added in the Network pageWEBPASSWORD: set the password to protect your PiHole instance
Env
  • Restart policy: update this to Unless stopped
  • Capabilities: enable NET_ADMIN

Step 4: Update OMV DNS settings

Lastly, log into your OMV dashboard, go to Network → Interfaces and edit eth0 record. Under Advanced settings, add the Google DNS record (or anything you wish) and save and apply the changes.

OMV Network → Interfaces → Advanced settings
Pi-hole dashboard

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kavindu Narathota

Kavindu Narathota

After working in the tech industry for a while, I learned a thing or two about Software & Product Engineering. www.narathota.com