Raspberry Pi – Unifi Cloud Controller

I have had a single Unifi access point at home for a while now and I can honestly say. I love Unifi as a solution. I see myself upgrading my rather slow AP-AC to an AP-NANO or something similar. Even replacing my WatchGuard firewall with a Unifi security gateway.

Since I got my AP-AC (second hand). I have used the Unifi controller as a plugin on my FreeNAS box (nicknamed ‘ORIAN’). But as I don’t run my FreeNAS server all the time in an effort to conserve energy. My controller spends more time offline than it does online. This is not a massive problem, but differently something I would like to address if I plan to upgrade to more Unifi gear in the future.

So today I am migrating my existing virtualized Unifi Cloud controller, to a Raspberry Pi. Mainly as I have lodes of these hanging around.

Taking a backup of my existing controller

The first thing I did is take a backup of my existing controller to do this, I logged into my FreeNAS and accessed it via the plugins page. Once in here I logged into my Unifi controller and navigated to Settings > Maintenance > Backup. As documented in this support post.

Once I had my backup file, I shutdown and disabled the existing controller plugin in FreeNAS.

Setting up the Pi

To start with, I imaged the Pi with Raspberry Pi OS. I am using a Raspberry Pi 3. I am only using a 8GB SD card, as I do not need that much storage, but it is a class 10, so that it has the speed.

Once the Pi was setup, I went though the existing steps to setting up any new Pi:

  • Hostname change
  • Enable SSH
  • Apt-get upgrade & upgrade

etc.

However this time, I did not set a static IP. Instead I defined a reservation in my firewall. I think I am going todo this moving forward as this way the same physical device will always retain the same IP.

After this I updated the DNS record in my DNS server (bind9 running on another Pi).

Installing Unifi Controller

Todo this, I am following this guide but I will summaries the install below.

Make sure we are all up to date:

sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove && sudo apt-get autoclean

Install haveged:

sudo apt-get install haveged -y

Install Java:

sudo apt-get install openjdk-8-jre-headless -y

Add the Unifi repository:

echo 'deb http://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list

Add GDP Key:

sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ubnt.com/unifi/unifi-repo.gpg

Install Unifi Controller:

sudo apt-get update; sudo apt-get install unifi -y

Cleanup Mongo DB

sudo systemctl stop mongodb
sudo systemctl disable mongodb

Reboot:

sudo reboot

Restoring the backup

Once I got the controller installed and the Pi rebooted. I can now navigate to https://IPADDRESS:8443.

Once you have got to the web UI, Don’t enter the name select “Or restore setup from backup”. Then once you have clicked on this select. “My Local Backup”. This should then show a file select window. Then select the file and the file should then restore your new controller exactly as the old one.


Hardware, Networking, Raspberry Pi, Tech, Ubiquiti
October 12, 2020
placeholder user
Author: John Hart

Leave a Reply

Your email address will not be published. Required fields are marked *