Pi UniFi Controller

Board version: Pi 3 B+ Rev 1.3
Memory: 1 GB
RPi OS version: Lite 64-bit
HAT: Raspberry Pi PoE+ HAT

Note that before proceeding you will need to be running a 64-bit version of Raspberry Pi OS for this tutorial to work.

Installing the UniFi Controller on the Raspberry Pi

UniFi is a range of network devices created by Ubiquiti. These devices range from Wi-Fi access points to security gateways and switches.
Using the UniFi network controller, you can manage all the UniFi devices that are a part of your network. You will also be able to use this dashboard to see the statistics of your UniFi network.



Basic installation OS


Adding rng-tools

To improve the startup speed of the UniFi controller software on our Raspberry Pi, we need to install rng-tools. We will utilize this package to ensure the Raspberry Pi has enough entropy for the random number generation that the UniFi software uses: $ sudo apt install rng-tools

We now need to make a slight change to the rng-tools configuration. Begin editing the config file by running the following command: $ sudo nano /etc/default/rng-tools-debian

Within this file, find and uncomment the following line.
Find: #HRNGDEVICE=/dev/hwrng uncommenting this line: HRNGDEVICE=/dev/hwrng By uncommenting this line, we are adding to the amount of entropy (The amount of randomness) that the system has available. The Raspberry Pi features an integrated random number generator that we can utilize to increase the entropy pool.
Once you have made the change, Save the file.

Finally, restart the rng-tools service by running the command below: $ sudo systemctl restart rng-tools


Installing LibSSL1.1

Due to the version of MongoDB that we will be utilizing, we will need to install LibSSL 1.1 to our Raspberry Pi. You can install this release of LibSSL by using the following command in the terminal: $ sudo apt install libssl1.1


Installing MongoDB

To use the UniFi Controller on your Raspberry Pi, we will need to install MongoDB. This is the database server that UniFi uses to store all of its data. As we can’t rely on the package repository, we will need to follow some additional steps. For this first step, we will download MongoDB 4.4.18 to our Pi. We are installing 4.4 as this is currently the only supported release for the UniFi Controller that is compatible with the Raspberry Pi. $ wget https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/4.4/multiverse/binary-arm64/mongodb-org-server_4.4.18_arm64.deb -O mongodb.deb

Once the package is downloaded, install it by using the following command within the terminal: $ sudo dpkg -i mongodb.deb

Now that we have installed the MongoDB server, set it to start when your Raspberry Pi boots using the command below: $ sudo systemctl enable mongod

Finally, start MongoDB by running the command shown below in the terminal. This will start the server immediately, so we won’t have to wait till our device restarts: $ sudo systemctl start mongod


Installing the UniFi Controller

Our first task is to add the UniFi repository to our sources list. We can achieve this by running the command below: $ echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/ubiquiti-archive-keyring.gpg] https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list >/dev/null You might notice that we are using “amd64” and not “arm64” or “armhf“. This is due to Ubiquiti not having their repository set up to mark “arm64” as compatible. However, it doesn’t hugely matter as, at the moment, it will still download files compatible with our Raspberry Pi.

We now need to add the repositories GPG key by using the following command: $ curl https://dl.ui.com/unifi/unifi-repo.gpg | sudo tee /usr/share/keyrings/ubiquiti-archive-keyring.gpg >/dev/null The GPG key is what helps tell the package manager it is downloading the correct package.

As we made changes to the repositories, we need to now update the package list by running the command below: $ sudo apt update

Now finally, we can install version 17 of the OpenJDK runtime as well as the Unifi Controller software itself to our Raspberry Pi by running the following command: $ sudo apt install openjdk-17-jre-headless unifi Installing UniFi through this method will automatically set up a service. This service will automatically start the UniFi software at boot.
Additionally, we are installing version 17 of the Java runtime environment as it is currently the only version supported by the UniFi controller.


Increasing Swap on a Pi

  • ≧ RPi 4, With the introduction of the RPi 4, there has been less of a need to use a swap file due to the large amounts of RAM available.
  • ≦ RPi 3+, Increasing Swap on a Pi


First Boot of the UniFi Controller on your Raspberry Pi

With your Raspberry Pi’s IP address handy, go to the following web address in your favorite web browser: https://[IPADDRESS]:8443 If you run into a certificate error, it is safe to ignore it as we know what device we are connecting to.


Installation Raspberry Pi PoE+ HAT

See Raspberry Pi PoE+ HAT page