}

Unifi controller install steps and troubleshooting

Created:

Introduction

Ubiquiti unifi controller is a Java application that uses mongodb. In this tutorial we are going to explain how to install it in Ubuntu 18.04.

Step 1: Adding ubiquiti repository

We need to add ubiquiti repository to apt:

echo 'deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti' | sudo tee -a /etc/apt/sources.list.d/100-ubnt.list

Then we need to add the keys for unifi. This will allow you to download from the repository we added in previous steps. Without this step you will have problems while installing unifi.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv C0A52C50 && sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10

Step 2: Installing unifi

Now update and install unifi with:

sudo apt update
sudo apt install unifi

If everything is fine go to localhost at port 8443.

Troubleshooting

Manually start unifi controller

Go to /usr/lib/unifi and execute unifi with:

sudo java -Xmx1024M -jar lib/ace.jar start

Monitor the logs with:

sudo tail -f /usr/lib/unifi/logs/server.log

Make sure you are using the proper java

sudo update-alternatives --config java

MongoDB incompatiblity

If you have this error:

[2018-05-26 18:16:45,688] <db-server> INFO  db     - DbServer stopped
[2018-05-26 18:17:04,640] <db-server> ERROR system - [exec] error, rc=2
[2018-05-26 18:18:04,684] <db-server> INFO  db     - DbServer stopped

There's an incompatibility between unifi and the latest mongodb. unifi's passing a no longer supported parameter. Replace mongod with:

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