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 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. A Raspberry Pi is small and power-efficient, and packs more than enough punch to run the application (even the gen 1 Model B) and control quite 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). Alternatively, you could use Ubuntu Server, but these instructions were tested with Raspbian. We recommend the Lite image, without the GUI, as you won’t be accessing the machine often once configured, and forgoing the GUI will allow the controller to use more resources. 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 and in a terminal window, or remotely connected through SSH.

The first configuration modification is to reduce the memory split down to 16MB from the default of 64MB. This is not necessary on newer models with more ram (1GB and up), but a must for older ones such as the 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)

You will need to reboot before the changes take effect, which can be done now or at your convenience. Ideally, you should reboot before installing the software.

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)

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, but 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 servers 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 (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.