- Last tested version: 5.7.20
- Make sure LXC has more than 12GB, otherwise Unifi fails to start!
# for unifi
echo 'deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list
wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ubnt.com/unifi/unifi-repo.gpg
# for mongodb
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
apt update
apt install unifi mongodb-org
systemctl enable unifi
systemctl enable mongod
Unifi throws some cryptic error messages:
cat /usr/lib/unifi/logs/server.log
When LXC had <12GB allocated: <UniFi> ERROR system - [exec] error,rc=1
When it could not connect to mongod: <db-server> ERROR system - [exec] error, rc=2
To fix mongod issue, need to replace /usr/lib/unifi/bin/mongod:
cd /usr/lib/unifi/bin
mv mongod mongod.old
nano mongod
#!/bin/bash
exec /usr/bin/mongod ${*//--nohttpinterface/}
chmod 755 /usr/lib/unifi/bin/mongod
Got bitten by the mongod bug again after upgrading to Unifi 5.7.20. I guess it will probably happen every upgrade. Thank you to past-me for taking notes and saving my time!