Installing UniFi Controller Software on a Raspberry Pi

Even though I've deployed thousands of dollars worth of Ubiquiti equipment for clients, I don't actually have any in my home. Today, that changes with the delivery of the Switch Flex Mini (USW-Flex-Mini). Since this is a fairly barebones product, it does not come with Bluetooth® for provisioning. Fortunately, I have a plethora of Raspberry Pis available for installing the UniFi software on.
Before you purchase a USW-Flex-Mini, be aware that you can only use a single untagged VLAN per switch port. You cannot setup ports to use custom port profiles (e.g. multiple tagged VLANs per port).
Initialize the Pi
I'm using a Pi 3 with a 64GB SD card, connected to the network via Ethernet.
sudo apt update && sudo apt upgrade -y && reboot
$ passwd
Changing password for pi.
Current password:
New password:
Retype new password:
passwd: password updated successfully
Enable Randomness
In order for the UniFi software to start without hanging, rng-tools
must be installed to make use of the Pi's built-in random number generator.
sudo apt install rng-tools
rng-tools
.sudo nano /etc/default/rng-tools
rng-tools
config file.Uncomment the following line:
HRNGDEVICE=/dev/hwrng
sudo systemctl restart rng-tools
rng-tools
for the change to take effect.Install OpenJDK
sudo apt install openjdk-8-jre-headless
Install the UniFi Controller Software
In order to install the UniFi software, the repository and its GPG keys must be added.
echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/ubnt-unifi.list
sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg
sudo apt update
Just like we installed rng-tools
and the JRE, the UniFi Controller software can be installed with this simple command:
sudo apt install unifi
Once that command if finished, you should be able to access the console at https://raspberrypi:8443
(replace raspberrypi
with the IP address of your Pi). You will get a certificate warning as well, which you should normally not bypass, however this is okay since the Pi is within your local network. To avoid the certificate warnings, you could set up your own private PKI (like cloudflare/cfssl: CFSSL: Cloudflare's PKI and TLS toolkit) or use Lets Encrypt.