Install Unifi controller on Ubuntu

Follow these easy update instructions to install latest Unifi controller on Ubuntu and run once per month.
Make a copy of the VM first (keep NAT settings to force same IP), shut it down, and use the copy VM as a test.

22 May 2022

Updated to version 7.1.65

20 Apr 2022

Updated to version 7.0.25

31 Dec 2021

Updated to version 6.5.55

10 Oct 2021

Updated to version 6.4.54

18 Jul 2021

Updated to version 6.2.26

24 May 2021

Updated to version 6.2.25

29 Jan 2021

Updated to version 6.0.45

27 Jan 2021

Disk space is running low and /var/lib/mongodb/journal/* has lots of files in it. On a test VM, modify /etc/mongod.conf to add in small files for journal. See https://docs.mongodb.com/v3.4/reference/configuration-options/

Then do the following:

sudo service mongodb stop (or find processID and kill it)
sudo rm -rf /var/lib/mongodb/journal/*
sudo service mongodb start (or reboot)

The WiredTigerLog files in /var/lib/mongodb/journal/* are still 100MB large but after testing the Unifi app with the old journals cleared out the web application is responding normally.

Since the test VM still had 100MB journal files, did not do that on the primary VM.

9 Jan 2021

Updated to version 6.0.43

6 Dec 2020

Updated to version 6.0.41

23 Nov 2020

Updated to version 6.0.36

27 Oct 2020

Updated to version 6.0.28

18 Sep 2020

Updated to version 6.0.22

23 Aug 2020

Updated to version 5.14.22

20 Jul 2020

Updated to version 5.13.32

19 Jun 2020

Updated to version 5.13.29

16 May 2020

Updated to version 5.12.72

27 Mar 2020

Updated to version 5.12.66

24 Jan 2020

MongoDB 3.4 keys expired. Fix following steps in https://stackoverflow.com/questions/34733340/mongodb-gpg-invalid-signatures

sudo apt-key list | grep -A 1 expired

Copy the 40-hex-digit fingerprint and run:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys $FINGERPRINT 

where $FINGERPRINT is the value you copied (if it contains spaces, put quotes around it).

8 Nov 2019

Updated to version 5.12.22

11 Oct 2019

Unifi controller update log:

dpkg -l | grep unifi
dpkg -l | grep mongo
dpkg --remove --force-remove-reinstreq unifi
wget https://get.glennr.nl/unifi/install/install_latest/unifi-latest.sh; chmod +x unifi-latest.sh; ./unifi-latest.sh
apt purge unifi mongod*
./unifi-latest.sh
./unifi-5.11.50.sh 
./unifi-5.11.50.sh -skip

12 Sep 2019

Could not connect to the local Unifi controller monitoring webpage. See section about moving mongod to mongo.bin and next steps. After completing that, the service access using the web browser came back.

Main install notes

These instructions were validated for unifi controller v5.7.23 being installed on Ubuntu 18.04 LTS.

$ sudo -s
$ cd /root
$ mkdir downloads

Download and then install the latest controller software from ubnt.com. It will be named something like "unifi_sysvinit_all.deb":

apt-get install ./unifi_sysvinit_all.deb

Fix /usr/bin/mongod as noted in community.ubnt.com:

$ cd /usr/bin
$ sudo -s
$ mv mongod mongod.bin

Replace mongod with the following:

#!/bin/bash
cleaned_args=$(echo $* | sed -e 's/--nohttpinterface//')
exec /usr/bin/mongod.bin ${cleaned_args}

Fix permissions:

$ chmod +x mongod

Restart services:

$ systemctl restart unifi
$ systemctl status unifi

If desired, cat /var/log/unifi/server.log and mongod.log to ensure no errors are reported.

Now you may use the VM or another machine to access the webpage on the virtual machine's IP (https://VM_IP_ADDRESS:8443/login)

If the AP can't be found, do the following:

ssh to AP IP address and login as ubnt, using the default password ubnt. You may need to factory reset the controller if the password has been changed.

Tell the AP where the controller software is running (IP below is VirtualMachine noted above):

set-inform http://192.168.1.182:8080/inform

Then login to the controller and adopt the AP.

NOTE: If the controller won't adopt, you may have to factory reset it by logging via ssh and issuing hte command set-default. See tips at https://lazyadmin.nl/home-network/unifi-adoption-failed/

Always follow the instructions when you ssh into the AP…you may need to run the set-inform command again.

Additional notes on adopting a new AP: https://help.ubnt.com/hc/en-us/articles/360012622613-UniFi-Device-Adoption

Other notes: