Skip to content

Instantly share code, notes, and snippets.

Last active January 23, 2019 11:15
  • Star 12 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Steps to install Unifi 5.6.29 in a Ubuntu 16.04 unpriveleged LXC
  • Last tested version: 5.7.20

0. Preparation

  • Make sure LXC has more than 12GB, otherwise Unifi fails to start!

1. Follow steps from Ubiquiti site

# for unifi
echo 'deb stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list
wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg
# for mongodb
apt-key adv --keyserver hkp:// --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb [ arch=amd64,arm64 ] 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

2. Ensure systemd services are enabled

systemctl enable unifi
systemctl enable mongod

3. If errors occur!

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

exec /usr/bin/mongod ${*//--nohttpinterface/}

chmod 755 /usr/lib/unifi/bin/mongod

Copy link

ammgws commented Apr 10, 2018

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!

Copy link

mhirsch commented Aug 2, 2018

Thanks very much for posting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment