Pi-Hole on Ubuntu VM with TrueNAS

Having a dozen Raspberry Pi’s around the house is nice for random projects, but I would like to consolidate as much as I can into jails on FreeNAS/TrueNAS. Unfortunately, running Pi-Hole on a jail isn’t really supported at this point, with previous attempts being abandoned by the community. Deploying it as a VM is the next best thing.

Requirements

Ubuntu Server 21.x
VM with a minimum 1 vCPU, 512MB vRAM, and 10GB Drive

Deployment Steps

Download Ubuntu Server ISO

Create a new VM in TrueNAS, using whatever values you prefer.
Guest Operating System should be Linux
Boot Method should be UEFI
Bind should be the primary IP of your TrueNAS

Operating System

Configure desired system requirements
The minimum requirements were listed above, but I would add another vCPU core and some additional RAM

VM CPU and Memory

Configure VM Disks
Create new Disk Image and make sure to select AHCI as disk type.
Select a Zvol location on your NAS
I used a 12 GB Drive, which is probably overkill for this

Disks

Network Interfaces and Installation Media
You can take the defaults on Network Interfaces
On Installation Media, upload the Ubuntu ISO you downloaded earlier, or select it from your TrueNAS if you have already copied it to a share.

Installation Media

Install Ubuntu OS
After saving the VM settings, power on and run through a default setup of Ubuntu.
Make sure to set the IP address of this VM with a static IP on your network, as this will be your new PiHole DNS Server.
Also, install OpenSSH during the install if you wish to SSH to Pi-Hole.
After installing Ubuntu, update the Ubuntu OS

sudo apt update
sudo apt upgrade

Install Pi-Hole
Run the following command in an SSH or Console session on the Ubuntu VM

sudo curl -sSL https://install.pi-hole.net | bash

Follow the Pi-Hole Wizard to configure additional settings
Choose your DNS provider (I used OpenDNS)
Take the defaults on the rest of the items unless you have specific reasons otherwise.

Pi-Hole Wizard

*Posts on this site may contain affiliated links*