Reply
New Member
Posts: 1
Registered: ‎01-13-2019

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl

@SmokingCrop thank you for the tutorial; it went smoothly for me.  I installed everything easily. I was curious about a VPN.  Do you know if I can add a VPN onto the same PI? Alternatively, should I use another one?  Also, do you have any knowledge of a solid VPN tutorial?

Emerging Member
Posts: 45
Registered: ‎05-22-2016
Kudos: 62

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl


@mpskierbg wrote:

@SmokingCrop thank you for the tutorial; it went smoothly for me.  I installed everything easily. I was curious about a VPN.  Do you know if I can add a VPN onto the same PI? Alternatively, should I use another one?  Also, do you have any knowledge of a solid VPN tutorial?


I have not tried a VPN through a Raspberry PI myself, but this one seems nice:

http://www.pivpn.io/

with a walktrough: https://www.sitepoint.com/setting-up-a-home-vpn-using-your-raspberry-pi/

New Member
Posts: 39
Registered: ‎12-16-2018

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl

If you enable SSH authentication on the Unifi controller, how would you SSH to the controller when SSH port 22 connects to the Pi?

Emerging Member
Posts: 45
Registered: ‎05-22-2016
Kudos: 62

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl


@Dudemax wrote:

If you enable SSH authentication on the Unifi controller, how would you SSH to the controller when SSH port 22 connects to the Pi?


SSH Authentication on the controller is to connect to your UniFi devices.

So you'd have to use the IP of the device (usg, switch, ap) instead of the Raspberry Pi.

 

If you want to see the files of the UniFi controller via SSH, you have to SSH to the Raspberry Pi as the controller itself is installed on it. The UniFi files are at /usr/lib/unifi

New Member
Posts: 26
Registered: ‎03-23-2016
Kudos: 2

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl

Huge shout out to Smokingcrop. Just wanted to say thanks heaps for the tutorial and for the scripts as well. Everything worked a treat!

Emerging Member
Posts: 45
Registered: ‎05-22-2016
Kudos: 62

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl

I've moved the scripts to my Github project instead of using Onedrive links.
Tested out the command to run download/run the script and it still works good.

 

Easier to track changes and such.

New Member
Posts: 26
Registered: ‎03-23-2016
Kudos: 2

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl

I must have mucked up my controller login/password combo and wasn't able to reset it, so I reinstalled everything from scratch following the script and now I'm not able to login to the controller on port 8443. 

 

Is it possible something changed since moving from onedrive to github? It doesn't look like the controller is running at all.

 

top.jpg

 

 

Emerging Member
Posts: 45
Registered: ‎05-22-2016
Kudos: 62

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl


@nottas wrote:

I must have mucked up my controller login/password combo and wasn't able to reset it, so I reinstalled everything from scratch following the script and now I'm not able to login to the controller on port 8443. 

 

Is it possible something changed since moving from onedrive to github? It doesn't look like the controller is running at all.

 


Hmm, strange.
I've formatted my microSD card and started over by using the script.
I could immediately see the setup of the UniFi controller on port 8443 (after the certificate warning).


It may sound silly, but have you tried rebooting?

New Member
Posts: 26
Registered: ‎03-23-2016
Kudos: 2

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl

I just tried installing from scratach again and noticed this error during the script install:

 

The UniFi controller will be installed now.


dpkg-deb: error: 'unifi__sysvinit_all.deb' is not a debian format archive
dpkg: error processing archive unifi__sysvinit_all.deb (--install):
 subprocess dpkg-deb --control returned error exit status 2
Errors were encountered while processing:
 unifi__sysvinit_all.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


Pi-hole will be installed now.
The initial configuration is interactive.

I only have a limited knowledge of linux, so I apologise in advance if I am doing something odd.

 

Emerging Member
Posts: 45
Registered: ‎05-22-2016
Kudos: 62

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl


@nottas wrote:

I just tried installing from scratach again and noticed this error during the script install:

 

The UniFi controller will be installed now.


dpkg-deb: error: 'unifi__sysvinit_all.deb' is not a debian format archive
dpkg: error processing archive unifi__sysvinit_all.deb (--install):
 subprocess dpkg-deb --control returned error exit status 2
Errors were encountered while processing:
 unifi__sysvinit_all.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


Pi-hole will be installed now.
The initial configuration is interactive.

I only have a limited knowledge of linux, so I apologise in advance if I am doing something odd.

 


I think you havent entered the version of unifi that you want at the beginning of the script, like 5.9.29

New Member
Posts: 26
Registered: ‎03-23-2016
Kudos: 2

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl

That was it. I must have mistyped it. Thanks again for the help.

New Member
Posts: 4
Registered: 2 weeks ago
Kudos: 1

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl

Thank you so much @SmokingCrop for a great written tutorial. Im getting some problems though im unsure of why.. Read through all the pages in this thread but nobody seem to get this problem. My knowledge in RPI, SSH, Linux etc.. is very limited.. So I dont really know how to solve it.. Problems seem to start here: sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ubnt.com/unifi/unifi-repo.gpg --2018-11-13 14:23:13-- https://dl.ubnt.com/unifi/unifi-repo.gpg Resolving dl.ubnt.com (dl.ubnt.com)... 52.84.215.231 Connecting to dl.ubnt.com (dl.ubnt.com)|52.84.215.231|:443... connected. ERROR: The certificate of ‘dl.ubnt.com’ is not trusted. ERROR: The certificate of ‘dl.ubnt.com’ is not yet activated. The certificate has not yet been activated So the next command : sudo apt-get update; sudo apt-get install unifi -y brings this: Hit:1 http://raspbian.raspberrypi.org/raspbian stretch InRelease Hit:2 http://archive.raspberrypi.org/debian stretch InRelease Ign:3 https://www.ui.com/downloads/unifi/debian stable InRelease Ign:4 https://www.ui.com/downloads/unifi/debian stable Release Ign:5 https://www.ui.com/downloads/unifi/debian stable/ubiquiti all Packages Ign:6 https://www.ui.com/downloads/unifi/debian stable/ubiquiti armhf Packages Ign:7 https://www.ui.com/downloads/unifi/debian stable/ubiquiti Translation-en Ign:8 https://www.ui.com/downloads/unifi/debian stable/ubiquiti Translation-en_GB Ign:5 https://www.ui.com/downloads/unifi/debian stable/ubiquiti all Packages Ign:6 https://www.ui.com/downloads/unifi/debian stable/ubiquiti armhf Packages Ign:7 https://www.ui.com/downloads/unifi/debian stable/ubiquiti Translation-en Ign:8 https://www.ui.com/downloads/unifi/debian stable/ubiquiti Translation-en_GB Ign:5 https://www.ui.com/downloads/unifi/debian stable/ubiquiti all Packages Ign:6 https://www.ui.com/downloads/unifi/debian stable/ubiquiti armhf Packages Ign:7 https://www.ui.com/downloads/unifi/debian stable/ubiquiti Translation-en Ign:8 https://www.ui.com/downloads/unifi/debian stable/ubiquiti Translation-en_GB Ign:5 https://www.ui.com/downloads/unifi/debian stable/ubiquiti all Packages Ign:6 https://www.ui.com/downloads/unifi/debian stable/ubiquiti armhf Packages Ign:7 https://www.ui.com/downloads/unifi/debian stable/ubiquiti Translation-en Ign:8 https://www.ui.com/downloads/unifi/debian stable/ubiquiti Translation-en_GB Ign:5 https://www.ui.com/downloads/unifi/debian stable/ubiquiti all Packages Ign:6 https://www.ui.com/downloads/unifi/debian stable/ubiquiti armhf Packages Ign:7 https://www.ui.com/downloads/unifi/debian stable/ubiquiti Translation-en Ign:8 https://www.ui.com/downloads/unifi/debian stable/ubiquiti Translation-en_GB Ign:5 https://www.ui.com/downloads/unifi/debian stable/ubiquiti all Packages Err:6 https://www.ui.com/downloads/unifi/debian stable/ubiquiti armhf Packages server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: noneIgn:7 https://www.ui.com/downloads/unifi/debian stable/ubiquiti Translation-en Ign:8 https://www.ui.com/downloads/unifi/debian stable/ubiquiti Translation-en_GB Reading package lists... Done W: The repository 'http://www.ubnt.com/downloads/unifi/debian stable Release' does not have a Release file. N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use. N: See apt-secure(8) manpage for repository creation and user configuration details. E: Failed to fetch https://www.ui.com/downloads/unifi/debian/dists/stable/ubiquiti/binary-armhf/Packages server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none E: Some index files failed to download. They have been ignored, or old ones used instead. Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package unifi Whats wrong here.. Thanks!
New Member
Posts: 26
Registered: ‎03-23-2016
Kudos: 2

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl

@Nimdjid 

 

Just run through steps 1 - 5 underneath the title "Login via SSH and change the password".

 

The script works brilliantly.

New Member
Posts: 4
Registered: 2 weeks ago
Kudos: 1

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl

my post got totally fcked up I see now..

 

Anyway Im right now trying the "all in one" script.

Its downloading some stuff right now at least.

I'll keep u updated Man Happy

New Member
Posts: 4
Registered: 2 weeks ago
Kudos: 1

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl

Ohh well...

After what seems like 3 hours of testing and error searching..

This is what I came across and how I solved it.

 

IF you get certificate problems like I did, you need to make sure the TIME is actually correct on the pi. If its. like in my case several months old, you need to change it.

Try in SSH write date and you see what date its set up to. If its incorrect then certificates might not work.

 

The reason my pi did not have correct time is because I had to open port 123 UDP in the router. This is to allow NTP which is this:

Network Time Protocol.

If this is not open then the PI will not get the correct date updates even if you set it up through: raspi-config .

 

So: Open port 123 UDP protocol. Run raspi-config in SSH prompt. Choose localisation options and timezone. Put your timezone there for your closest city. Reboot the raspberry. NOW you can run the commands.

Then you can close 123 port again if u like.

New Member
Posts: 39
Registered: ‎12-16-2018

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl

[ Edited ]

UniFi Network Controller 5.10.12 Stable Candidate has been released

https://community.ubnt.com/t5/UniFi-Updates-Blog/UniFi-Network-Controller-5-10-12-Stable-Candidate-h...

 

I ran :

sudo apt-get update

sudo apt-get upgrade -y

 

It didn't update the controller and I'm still on 5.9.29

 

Tried the update.sh script:

 

--2019-02-05 05:53:57-- http://dl.ubnt.com/unifi/5.10.12/unifi_sysvinit_all.deb
Resolving dl.ubnt.com (dl.ubnt.com)... 13.35.97.126
Connecting to dl.ubnt.com (dl.ubnt.com)|13.35.97.126|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-02-05 05:53:57 ERROR 404: Not Found.

 

The UniFi controller will now be upgraded.


dpkg-deb: error: 'unifi_5.10.12_sysvinit_all.deb' is not a debian format archive
dpkg: error processing archive unifi_5.10.12_sysvinit_all.deb (--install):
subprocess dpkg-deb --control returned error exit status 2
Errors were encountered while processing:
unifi_5.10.12_sysvinit_all.deb


Pi-hole will now be upgraded.


[i] Checking for updates...
[i] Pi-hole Core: up to date
[i] Web Interface: up to date
[i] FTL: up to date

[✓] Everything is up to date!

New Member
Posts: 39
Registered: ‎12-16-2018

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl

[ Edited ]

This works

 

wget https://dl.ubnt.com/unifi/5.10.12-20644d4901/unifi_sysvinit_all.deb

sudo dpkg -i unifi_sysvinit_all.deb

 

but now unifi has problem starting

 

pi@raspberrypi:~ $ sudo service unifi status
● unifi.service - unifi
Loaded: loaded (/lib/systemd/system/unifi.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2019-02-05 06:09:53 GMT; 11min ago
Process: 610 ExecStart=/usr/lib/unifi/bin/unifi.init start (code=exited, status=0/SUCCESS)
Main PID: 716 (jsvc)
CPU: 11.744s
CGroup: /system.slice/unifi.service
├─716 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre -cp /u
├─717 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre -cp /u
└─718 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre -cp /u

Feb 05 06:08:09 raspberrypi systemd[1]: Starting unifi...
Feb 05 06:08:30 raspberrypi unifi[717]: Feb 05, 2019 6:08:30 AM org.apache.commons.httpclient.HttpMe
INFO: I/O exception (java.net.ConnectException) caught when
Feb 05 06:08:30 raspberrypi unifi[717]: Feb 05, 2019 6:08:30 AM org.apache.commons.httpclient.HttpMe
INFO: Retrying request
Feb 05 06:08:30 raspberrypi unifi[717]: Feb 05, 2019 6:08:30 AM org.apache.commons.httpclient.HttpMe
INFO: I/O exception (java.net.ConnectException) caught when
Feb 05 06:08:30 raspberrypi unifi[717]: Feb 05, 2019 6:08:30 AM org.apache.commons.httpclient.HttpMe
INFO: Retrying request
Feb 05 06:08:30 raspberrypi unifi[717]: Feb 05, 2019 6:08:30 AM org.apache.commons.httpclient.HttpMe
INFO: I/O exception (java.net.ConnectException) caught when
Feb 05 06:08:30 raspberrypi unifi[717]: Feb 05, 2019 6:08:30 AM org.apache.commons.httpclient.HttpMe
INFO: Retrying request
Feb 05 06:09:53 raspberrypi unifi.init[610]: Starting Ubiquiti UniFi Controller: unifi failed!
Feb 05 06:09:53 raspberrypi systemd[1]: Started unifi.

 

 

Back on 5.9.29

Emerging Member
Posts: 45
Registered: ‎05-22-2016
Kudos: 62

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl


@Dudemax wrote:

This works

 

wget https://dl.ubnt.com/unifi/5.10.12-20644d4901/unifi_sysvinit_all.deb

sudo dpkg -i unifi_sysvinit_all.deb

 

but now unifi has problem starting


Did you upgrade your java, as the version that is in the repository for Raspbian is too old for the new 5.10.X controller?

 

"Note: You'll need a newer version for the new 5.10.x 'unstable' controller. The default java version in Raspbian is too old.
You can follow this guide to install the latest version:

https://ribasco.wordpress.com/2018/02/11/how-to-install-the-latest-java-version-in-raspbian-stretch/"

 

Also, the script only works for stable versions as the url  for it is different every version (has a bunch of numbers behind the version) until they release a stable version.

New Member
Posts: 26
Registered: ‎03-23-2016
Kudos: 2

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl

I managed to corrupt the controllers database a few times by incorrectly powering off the pi.

 

Could someone please confirm the correct way to shut down the device. Is it simply "poweroff" or should the controller be stopped first?

 

And any tips on backing up an image of the card would be great too.

 

Many thanks again for the guide!

New Member
Posts: 39
Registered: ‎12-16-2018

Re: [Step-By-Step Tutorial/Guide] Raspberry Pi with UniFi controller and Pi-hole from scratch (headl

[ Edited ]

5.10.12 Stable has been released.

https://community.ubnt.com/t5/UniFi-Updates-Blog/UniFi-Network-Controller-5-10-12-Stable-has-been-re...

 

Followed this guide to update Java

https://ribasco.wordpress.com/2018/02/11/how-to-install-the-latest-java-version-in-raspbian-stretch/

 

used update script and it's up and running but notice a few I/O exception on startup:

pi@raspberrypi:~ $ sudo service unifi status
● unifi.service - unifi
   Loaded: loaded (/lib/systemd/system/unifi.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2019-02-07 08:00:35 GMT; 4min 32s ago
 Main PID: 2643 (jsvc)
      CPU: 49.750s
   CGroup: /system.slice/unifi.service
           ├─2643 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/java-8-oracle/jre -cp /usr/share/java
           ├─2645 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/java-8-oracle/jre -cp /usr/share/java
           ├─2646 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/java-8-oracle/jre -cp /usr/share/java
           ├─2679 /usr/lib/jvm/java-8-oracle/jre/bin/java -Dfile.encoding=UTF-8 -Djava.awt.headless=
           └─2918 bin/mongod --dbpath /usr/lib/unifi/data/db --port 27117 --unixSocketPrefix /usr/li

Feb 07 07:59:47 raspberrypi systemd[1]: Starting unifi...
Feb 07 07:59:55 raspberrypi unifi[2645]: Feb 07, 2019 7:59:55 AM org.apache.commons.httpclient.HttpM
                                         INFO: I/O exception (java.net.ConnectException) caught when
Feb 07 07:59:55 raspberrypi unifi[2645]: Feb 07, 2019 7:59:55 AM org.apache.commons.httpclient.HttpM
                                         INFO: Retrying request
Feb 07 07:59:55 raspberrypi unifi[2645]: Feb 07, 2019 7:59:55 AM org.apache.commons.httpclient.HttpM
                                         INFO: I/O exception (java.net.ConnectException) caught when
Feb 07 07:59:55 raspberrypi unifi[2645]: Feb 07, 2019 7:59:55 AM org.apache.commons.httpclient.HttpM
                                         INFO: Retrying request
Feb 07 07:59:55 raspberrypi unifi[2645]: Feb 07, 2019 7:59:55 AM org.apache.commons.httpclient.HttpM
                                         INFO: I/O exception (java.net.ConnectException) caught when
Feb 07 07:59:55 raspberrypi unifi[2645]: Feb 07, 2019 7:59:55 AM org.apache.commons.httpclient.HttpM
                                         INFO: Retrying request
Feb 07 08:00:35 raspberrypi unifi.init[2554]: Starting Ubiquiti UniFi Controller: unifi.
Feb 07 08:00:35 raspberrypi systemd[1]: Started unifi.

 

 

Reply