Menu

UniFI Controller 5 on Raspberry Pi

Ubiquiti’s UniFi gear is managed through a web interface called the UniFi Controller. Because the controller is distributed both as a free download and as an hardware appliance—​the latter not free—​users can decide where to run the software.

Here we’ll show you how to install and configure the UniFi Controller onto your Raspberry Pi. Raspberry Pis are small and power-efficient; they pack more than enough punch to run the application (even the gen 1 Model B) and control more than a few devices.

Preparation

Start with a clean installation of Raspbian. We recommend using the Lite image provided by the Raspberry Pi Foundation over the one provided by Raspbian themselves (installation instructions). We recommend the Lite image—​which doesn’t include a Graphical User Interface—​as you won’t be accessing the machine itself often once configured, and forgoing the GUI will allow the controller to use more resources. Alternatively, you could use Ubuntu Server; the steps are likely very similar, but these instructions were tested with Raspbian Lite. In order to follow along, you should have the Pi connected to the network and ssh access enabled. We recommend against using a wireless connection as a bad configuration could lock the controller out of the network; preventing you from easily fixing it. All commands presented in this guide will assume that you are either physically present at the Pi with a keyboard and mouse in a terminal window, or remotely connected through SSH.

The first configuration modification is to reduce the memory split from the default of 64MB down to 16MB. This is not necessary on newer models with more RAM (1GB and up), but it is a must for older ones such as the Rapsbery Pis version 1 and 2.

  1. Enter sudo raspi-config on the command line

  2. Select Advanced Options

  3. Navigate to and select Memory Split

  4. Enter 16

  5. Select Ok (press Tab once)

  6. Select Finish (press Tab twice)

Next step is to generate an english locale because MongoDB requires one to be present.

  1. Enter sudo raspi-config on the command line

  2. Select Localisation Options

  3. Select Change Locale

  4. Make sure that an english UTF8 locale, e.g. en_US.UTF-8 UTF-8, is selected (Press Space)

  5. Select your default locale

  6. Select Finish (press Tab twice)

You will need to reboot before the changes take effect, so do so now.

Installation

This section will assume that you are on a command line.

First, we must ensure that the required APT tools have been installed. On most installations the software will already be present, but it doesn’t hurt to be certain.

sudo apt update && sudo apt install -y ca-certificates apt-transport-https

Next we add the UniFi repository and import the GPG key.

echo 'deb http://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50
sudo apt-get update

Finally, we get to the good stuff: installing the UniFi Controller. It’s a single command; it will pull in the required dependencies automatically. We explicitly get the headless version of the JDK as we don’t need all the graphical libraries. If you are running on the desktop edition of raspbian, use openjdk-8-jdk instead.

sudo apt-get -y install openjdk-8-jdk-headless unifi

The last step is to disable the default MongoDB server, as the controller starts its own, and there’s no need to have two instances running.

sudo systemctl disable mongodb
sudo systemctl stop mongodb

At this point, the UniFi Controller is bootstrapping itself, which can take quite some time on a Raspberry Pi. But do not despair, it will come up. It can take over 10 minutes to initialize, so now is a good time to go pour yourself a glass of water.

Old guidance involved removing the libubnt_webrtc_jni.so library on ARMv6 devices to prevent crashes (Raspberry Pi version 1 and Raspberry Pi Zero (W)); however, the controller has been updated such that leaving the library in place does not crash the software anymore.

Setup

Navigate to https://ip.address.of.controller:8443 and follow the setup guide.

There we go, you know have a working version of the UniFi Controller running on your very own Raspberry Pi.