Skip to content

Instantly share code, notes, and snippets.

@stevejenkins
Last active March 4, 2024 17:30
Show Gist options
  • Star 37 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save stevejenkins/731edee247483d7a0a939b68f00b8f3d to your computer and use it in GitHub Desktop.
Save stevejenkins/731edee247483d7a0a939b68f00b8f3d to your computer and use it in GitHub Desktop.
Pi-hole on UC-CK 0.13.6
# Instructions for installing Pi-hole 4.2 on UniFi CloudKey Gen 1 (UC-CK) running firmware 0.13.6
# Pi-hole will need to be completely re-installed after every FW update or if CloudKey is reset to defaults.
# Verify UC-CK is running firmware v0.13.6 (or later) before installing Pi-hole. If not, do:
ubnt-systool fwupdate https://dl.ubnt.com/unifi/stage/cloudkey/firmware/UCK/UCK.mtk7623.v0.13.6.7ad551e.190225.0939.bin
# UC-CK firmware v0.13.6 downgrades UniFi Controller to 5.10.17. Upgrade to 5.10.19 with:
cd /tmp
wget https://dl.ubnt.com/unifi/5.10.19/unifi_sysvinit_all.deb
dpkg -i unifi_sysvinit_all.deb
# All following commands will executed with sudo
sudo -i
# Update local package lists
apt-get update
# Install dnsmasq
apt-get install dnsmasq
# Downgrade to a specific 'libsqlite3-0' so Pi-hole script can install 'sqlite3'
apt-get install libsqlite3-0=3.8.7.1-1+deb8u4
# Install back-ported version of 'ifupdown' so Pi-hole script can install 'resolvconf'
apt-get install ifupdown=0.8.13~bpo8+1
# See that port 53 already in use by 'systemd-resolved'
netstat -plnt | grep :53
#Turn off local 'systemd-resolved'
sudo systemctl stop systemd-resolved
sudo systemctl disable systemd-resolved.service
# Download Pi-hole installation script and run locally
cd /tmp
wget -O basic-install.sh https://install.pi-hole.net
bash basic-install.sh
# During install, select 'eth0' for adapter, otherwise use all defaults
# Following install, set Pi-hole admin password
pihole -a -p
# Test Pi-hole DNS resolution -- resulting IP address(es) should be valid
dig @127.0.0.1 ui.com
# Test Pi-hole blocking -- resulting IP address should be '0.0.0.0'
dig @127.0.0.1 googleadservices.com
# Change Pi-hole web admin interface to port 81 (port 80 already used by UC-CK GUI)
sed -ie 's/= 80/= 81/g' /etc/lighttpd/lighttpd.conf
#Restart Pi-hole web admin interface
/etc/init.d/lighttpd restart
# Show Pi-hole chronometer (CTRL + C to exit)
pihole -c
# Go to http://ip.addr.of.cloudkey:81/admin/ to configure additional settings.
# OPTIONAL: UC-CK also supports these instructions for running unbound so your UC-CK can be an all-around DNS solution:
# https://docs.pi-hole.net/guides/unbound/
@christopherlister
Copy link

This is great.

@davidcomtois
Copy link

If you run into issues not being able to sudo apt-get update because backports is not longer found (and therefore, pi-hole install will fail). Try this: https://www.lucas-nussbaum.net/blog/?p=947

@jeffnewbold
Copy link

jeffnewbold commented May 6, 2019

how-to up there no longer works as of 5/11/2019.

First noticeable fail is at this point:
Install back-ported version of 'ifupdown' so Pi-hole script can install 'resolvconf'
apt-get install ifupdown=0.8.13~bpo8+1

gets this error:
E: Version '0.8.13~bpo8+1' for 'ifupdown' was not found

@slr01
Copy link

slr01 commented May 16, 2019

The link that @davidcomtois posted goes to a post that explains what's going on. The TLDR is that Jessie was removed from the mirror network so you'll need to get the backport from archive.debian.org.
Add the following to /etc/apt/sources.list: deb http://archive.debian.org/debian jessie-backports main
Then: echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until

@Francismori7
Copy link

Can't get this to work at all, just says -bash: pihole: command not found

@emax810
Copy link

emax810 commented Oct 7, 2019

how-to up there no longer works as of 5/11/2019.

First noticeable fail is at this point:
Install back-ported version of 'ifupdown' so Pi-hole script can install 'resolvconf'
apt-get install ifupdown=0.8.13~bpo8+1

gets this error:
E: Version '0.8.13~bpo8+1' for 'ifupdown' was not found

Same error :

> root@UniFi-CloudKey:/tmp# apt-get install ifupdown=0.8.13~bpo8+1
> Reading package lists... Done
> Building dependency tree       
> Reading state information... Done
> E: Version '0.8.13~bpo8+1' for 'ifupdown' was not found

@MrGh0sT
Copy link

MrGh0sT commented Oct 31, 2019

For apt-get install ifupdown=0.8.13~bpo8+1, just add jessie-backports repositery with:

deb http://archive.debian.org/debian/ jessie-backports main in your sources.list and
Acquire::Check-Valid-Until false; in /etc/apt/apt.conf

run apt-get update

and retype apt-get install ifupdown=0.8.13~bpo8+1
Retry Pi-Hole install, and it will good :)

But disable the backports repo for newer update.

@cloudycloud47
Copy link

cloudycloud47 commented May 13, 2020

Time to revise these instructions.
PiHole V5.0 doesn't like Debian Jessie

This will help but it doesn't update the FTL
sudo apt install php-xml-parser
sudo apt install libapache2-mod-php5
https://discourse.pi-hole.net/t/php-error-updating-to-v5-0/31896/8

This is the result:
Pi-hole Version v5.0 Web Interface Version v5.0 FTL Version v4.3.1 (Update available!)

Dashboard doesn't show any graphs.
New Group Management menus generate JSON errors.

@baraque
Copy link

baraque commented Jan 10, 2021

Successfully install Pi-hole in my CloudKey, here is a bit tweak, Thank you, OP!
https://gist.github.com/baraque/71eced2e5094c6a18e5ea99c243affed#gistcomment-3587747

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment