Skip to content

Instantly share code, notes, and snippets.

Embed
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

https://help.ubnt.com/hc/en-us/articles/220066768-UniFi-How-to-Install-Update-via-APT-on-Debian-or-Ubuntu

# 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

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

#!/bin/bash
exec /usr/bin/mongod ${*//--nohttpinterface/}

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

@ammgws

This comment has been minimized.

Copy link
Owner Author

@ammgws 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!

@mhirsch

This comment has been minimized.

Copy link

@mhirsch 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