Installing pihole on your Cloudkey gen2+
The other day I bought myself a Gen2 cloudkey plus from Ubiquiti and replace my old cloudkey. It comes installed with the Unifi SDN and the new Unifi Protect. The device looks really nice and has a little display which shows you information about the applications running on the device.
Since I have been playing with pi-hole lately on one of my Raspberry Pi’s, I was wondering if I could install pi-hole on the cloudkey so I would have everything from my network on a central place. With help of Google I managed to get it working by following the steps below:
First you have to install a DNS server on the cloudkey, since that’s used by the pi-hole software. ssh into your cloudkey and enter the following commands:
sudo –i
apt-get update
apt-get install dnsmasq
Than we can install the pi-hole software. I choose to download the install script and execute it on my device.
cd /tmp
wget -O basic-install.sh https://install.pi-hole.net
bash basic-install.sh
Keep all the defaults. the only thing I had to do was say no to keep the ip address from DHCP since it didn’t copy the IP adres, I entered it myself. During the install the lighttpd webservice will be installed too. This is used by the admin page.
Last thing is to change the default port of the website since that’s already taken by the cloudkey management interface. During pihole install lighttpd was installed
make a backup of the config:
cp /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.backup
sed -ie ‘s/= 80/= 81/g’ /etc/lighttpd/lighttpd.conf
or use vi/nano to edit the config file and change the server port
restart the webserver
/etc/init.d/lighttpd restart
<http://
Every time you run the pihole install you have to set the port of the webserver back to a non 80 port again
Let me know if this works for you or if I forgot to document a step.
Comments
Comment by Giovanni on 2018-12-20 04:36:50 -0800
Hello Matthijs,
I’m really interested in installing dnsmasq and Pi-Hole in my Unifi Cloud Key, which is not Gen2+.
Followed your detailed article above but stuck here cp /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.backup as it looks like lighttpd has not been installed. 🙁
Any hint?
Thanks
Giovanni
Comment by Bernhard on 2019-01-06 11:35:16 -0800
Hi Matthijs,
I tried following you instructions above but think I have the same problem as Giovanni. The lighttpd folder doesn’t exist and it looks light the install script failed somewhere…
Here’s the output I got after running it
[i] Existing PHP installation detected : PHP version 7.0.33-0+deb9u1
[✓] Disk space check
[✓] Update local cache of available packages
[✓] Checking apt-get for upgraded packages… 40 updates available
[i] It is recommended to update your OS after installing the Pi-hole!
[i] Installer Dependency checks…
[✓] Checking for apt-utils
[✓] Checking for dialog
[✓] Checking for debconf
[✓] Checking for dhcpcd5
[✓] Checking for git
[✓] Checking for iproute2
[✓] Checking for whiptail
[i] Using Google DNS servers
[i] Your static IPv4 address: 192.168.1.2
[i] Your static IPv4 gateway: 192.168.1.1
[i] Static IP already configured
[i] Unable to find IPv6 ULA/GUA address, IPv6 adblocking will not be enabled
[i] IPv4 address: 192.168.1.2
[i] IPv6 address:
[i] Web Interface On
[i] Web Server On
[i] Logging On.
[✓] Check for existing repository in /etc/.pihole
[✓] Update repo in /etc/.pihole
[✓] Check for existing repository in /var/www/html/admin
[✓] Update repo in /var/www/html/admin
[i] Main Dependency checks…
[i] Checking for bc (will be installed)
[✓] Checking for cron
[✓] Checking for curl
[i] Checking for dnsutils (will be installed)
[✓] Checking for iputils-ping
[i] Checking for lsof (will be installed)
[✓] Checking for netcat
[✓] Checking for psmisc
[✓] Checking for sudo
[i] Checking for unzip (will be installed)
[✓] Checking for wget
[i] Checking for idn2 (will be installed)
[i] Checking for sqlite3 (will be installed)
[✓] Checking for libcap2-bin
[✓] Checking for dns-root-data
[i] Checking for resolvconf (will be installed)
[i] Checking for lighttpd (will be installed)
[✓] Checking for php7.0-common
[i] Checking for php7.0-cgi (will be installed)
[i] Checking for php7.0-sqlite3 (will be installed)
Any help would be greatly appreciated.
Thanks!
Comment by Bernhard on 2019-01-06 11:52:34 -0800
Hi Matthijs,
I am trying to install this on a Cloud Key Gen2+ but am encoutering similar issue as Giovanni above – it doesn’t look like lighttpd is installing (probably several other ones not either). The folder lighttpd folder isn’t created under /etc .
Here’s the output I get
[i] Existing PHP installation detected : PHP version 7.0.33-0+deb9u1
[✓] Disk space check
[✓] Update local cache of available packages
[✓] Checking apt-get for upgraded packages… 40 updates available
[i] It is recommended to update your OS after installing the Pi-hole!
[i] Installer Dependency checks…
[✓] Checking for apt-utils
[✓] Checking for dialog
[✓] Checking for debconf
[✓] Checking for dhcpcd5
[✓] Checking for git
[✓] Checking for iproute2
[✓] Checking for whiptail
[i] Using Google DNS servers
[i] Your static IPv4 address: 192.168.1.2
[i] Your static IPv4 gateway: 192.168.1.1
[i] Static IP already configured
[i] Unable to find IPv6 ULA/GUA address, IPv6 adblocking will not be enabled
[i] IPv4 address: 192.168.1.2
[i] IPv6 address:
[i] Web Interface On
[i] Web Server On
[i] Logging On.
[✓] Check for existing repository in /etc/.pihole
[✓] Update repo in /etc/.pihole
[✓] Check for existing repository in /var/www/html/admin
[✓] Update repo in /var/www/html/admin
[i] Main Dependency checks…
[i] Checking for bc (will be installed)
[✓] Checking for cron
[✓] Checking for curl
[i] Checking for dnsutils (will be installed)
[✓] Checking for iputils-ping
[i] Checking for lsof (will be installed)
[✓] Checking for netcat
[✓] Checking for psmisc
[✓] Checking for sudo
[i] Checking for unzip (will be installed)
[✓] Checking for wget
[i] Checking for idn2 (will be installed)
[i] Checking for sqlite3 (will be installed)
[✓] Checking for libcap2-bin
[✓] Checking for dns-root-data
[i] Checking for resolvconf (will be installed)
[i] Checking for lighttpd (will be installed)
[✓] Checking for php7.0-common
[i] Checking for php7.0-cgi (will be installed)
[i] Checking for php7.0-sqlite3 (will be installed)
Any advice would be appreciated
Thanks!
Comment by KNIx on 2019-02-04 01:30:06 -0800
Add following command before starting the Pihole installation.
apt install libsqlite3-0=3.16.2-5+deb9u1
Comment by JD on 2019-03-11 16:54:18 -0800
You cannot find lighttpd because you have not installed it anywhere. Try installing the light httpd server on the cloud key. It should work after that.
Comment by JD on 2019-03-11 16:54:49 -0800
You cannot find lighttpd because you have not installed it anywhere. Try installing the light httpd server on the cloud key. It should work after that.
apt-get install lighttpd
Comment by JD on 2019-03-11 16:57:32 -0800
I have it installed on cloudkey and it works fine for me.
Comment by Andy on 2019-05-02 05:22:17 -0800
Ive (partly) been successful in getting this working, although as a few people have said, some of the individual packages (lighttpd, sql, others) had to be installed manually.
I was successfully blocking ads on the pihole instance on the cloudkey, but after a reboot of the cloudkey, DNSMASQ doesnt start automatically, indicating Port 53 is already in use.
I cant find out by what – any clues? I suspect whichever service it is will need to be delayed in starting until DNSMASQ gets there first.
Comment by Andy on 2019-06-21 23:09:36 -0800
Has anyone found a way to make Pihole persistent through a Cloudkey firmware upgrade?
Comment by Andy on 2019-06-21 23:47:32 -0800
Upgraded to CK firmware 1.06 and Pihole install script exits immediately ‘cancel selected’.
I’m still debugging.
Comment by Andy on 2019-06-22 01:17:18 -0800
In the end, I deleted /etc/pihole then a few manual installs (as above) before running the install script again
Comment by KNIx on 2019-06-24 01:03:35 -0800
For version 1.0.6
https://community.ui.com/questions/CK2-Firmware-0-9-4-Pi-Hole-install/ad79a1f0-fedf-4853-9435-a92d845e4025
I’ll update as it changes