Installing UniFi Network on Raspberry Pi OS 11 (bullseye)
Installing an Unifi controller on a Raspberry Pi seems like a straightforward task until you notice the section with system requirements.
The software requires a MongoDB version before 4.0. The last version that satisfies this is 3.7.9 which is almost four years old at the time of writing. You may find old versions packaged on the MongoDB website or in other repositories but certainly not for ARM. The second problem is that MongoDB dropped 32-bit support in version 3.4 so the latest we can actually use is 3.2.22 (also 4 years old).
In the end I was unable to find a build of MongoDB 3.2 that could run on a Pi which leaves only the option of compiling from source. This is what I ended up doing, it required lots of trial and error [1] before it succeeded. To (hopefully) save someone else time I put up the final Debian package for download.
Instructions
Requirements:
Raspberry Pi OS Lite 11 (bullseye)
armhf
Add the Unifi repository
apt install ca-certificates apt-transport-https echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' >/etc/apt/sources.list.d/100-ubnt-unifi.list apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50 apt update
Install required packages.
Create a mongod wrapper script
printf '%s\n' '#!/bin/bash' 'exec /usr/bin/mongod --journal "$@"' >/usr/lib/unifi/bin/mongod chmod +x /usr/lib/unifi/bin/mongod
Enable and start the Unifi service:
systemctl enable --now unifi
Wait a while, it can take about 5 minutes until the controller is reachable at
https://IP:8443/
.
Not actually using a Raspberry Pi?
On a normal amd64 Debian system this whole ordeal gets much simpler:
Unifi installation works as described as above
mongodb-org-server_3.6.23_amd64.deb
can be downloaded from the MongoDB website and runs out-of-the-boxOpenJDK 8 can be pulled from AdoptOpenJDK's repo since it's not available on recent Debian versions anymore
As of Unifi 7.3 the JDK support has changed to version 11, so you don't need a separate repo anymore.