In this article you will read about the steps necessary to install Ubiquit’s Unifi Controller on a Single Board Computer (SBC) like a RaspBerry Pi , Asus TinkerBoard or Odroid Xu4.
Contents
The only software requirements are Java 8, and most importantly, MongoDB inferior to version 3.6. Ubiquiti recommends version 3.4, which is only available for Debian 8
But we will be using Dietpi, which is an optimized version of Debian 9 for SBC’s
Install Dietpi
Download and install Dietpi for your device as described on Dietpi’s Main Site:
We won’t cover how to install Dietpi, they already have a great Getting started guide:
https://dietpi.com/phpbb/viewtopic.php?f=8&t=9#p9
Update Dietpi
Make sure your Dietpi is up to date by issuing follwoing command:
dietpi-update
It should tell you about possible updates and apply them:
<code>root@DietPi:~# dietpi-update [ OK ] DietPi-Update | Root access verified. [ OK ] DietPi-Update | RootFS R/W access verified. DietPi-Update ───────────────────────────────────────────────────── Mode: Checking for DietPi updates [ INFO ] DietPi-Update | Checking mirror: https://raw.githubusercontent.com/Fourdee/DietPi/master/dietpi/server_version-6 [ OK ] DietPi-Update | Using update server: https://raw.githubusercontent.com/Fourdee/DietPi/master/dietpi/server_version-6 [ INFO ] DietPi-Update | Current version : v6.19.7 [ INFO ] DietPi-Update | Latest version : v6.19.7 [ OK ] DietPi-Update | No updates required, your DietPi installation is up to date. </code>
Install Unifi prerequisites
Java8
apt install ca-certificates-java binutils jsvc libcommons-daemon-java openjdk-8-jre-headless
You can test if Java 8 is correctly installed by running “java -version”
root@DietPi:~# java -version<br> openjdk version "1.8.0_181"<br> OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-2~deb9u1-b13)<br> OpenJDK Client VM (build 25.181-b13, mixed mode)
Mongdodb <3.6
Here lies the main challenge. We are using raspbian’s Repository which is the only Repository to provide binaries for the required MongoDB version. For this, we will create a source entry called mongodb.list containing the repository information.
Create the file with following command:
echo 'deb http://archive.raspbian.org/raspbian stretch main contrib non-free rpi' | tee /etc/apt/sources.list.d/mongodb.list
Add the key for this repository:
wget https://archive.raspbian.org/raspbian.public.key -O - | apt-key add -
Update Repositories with command:
apt update
Install MongoDB:
apt install mongodb-server
Test MongoDB installation with following command:
mongo
Output should look like this:
root@DietPi:~# mongo<br> MongoDB shell version: 2.4.14<br> connecting to: test<br> Welcome to the MongoDB shell.<br> For interactive help, type "help".<br> For more comprehensive documentation, see<br> http://docs.mongodb.org/<br> Questions? Try the support group<br> http://groups.google.com/group/mongodb-user<br> Server has startup warnings:<br> Thu Jan 10 09:16:06.332 [initandlisten]<br> Thu Jan 10 09:16:06.332 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.<br> Thu Jan 10 09:16:06.332 [initandlisten] ** 32 bit builds are limited to less than 2GB of data (or less with --journal).<br> Thu Jan 10 09:16:06.332 [initandlisten] ** See http://dochub.mongodb.org/core/32bit<br> Thu Jan 10 09:16:06.332 [initandlisten]
Type exit to quit the MongoDB console.
Unifi Controller Package:
Download
The latest version of the package is available at ubnt.com’s Download section : https://www.ubnt.com/download/unifi/unifi-ap/uap
Click on the Download link “UniFi SDN Controller x.y.z LTS for Debian/Ubuntu Linux”, and accept the EULA. Copy the download link of the .deb package
Back in your Dietpi Setup, issue following command to download the package, but insert the copied link from above. Version 5.9.29 was the latest at the time of writing:
wget https://dl.ubnt.com/unifi/5.9.29/unifi_sysvinit_all.deb
Install Package
After the package has been downloaded, it can be installed with following command:
dpkg -i unifi_sysvinit_all.deb
You may encounter an error stating that there were some dependency problems. In that case, simply fix it by running:
apt install -f
Connect to Controller
Initial Setup
Simply use a Browser and connect to https://ip-of-dietpi:8443
You may have to accept a Certificate Warning.
The initial setup Wizard will show up:
Troubleshooting
Proxy
To download and install packages using a proxy, you need to use following commands:
export http_proxy=http://myproxy.mycompany.com:8080/
export https_proxy=http://myproxy.mycompany.com:8080/
echo 'Acquire::http::Proxy "http://myproxy.mycompany.com:8080";' | tee /etc/apt/apt.conf.d/90-proxy
GPG Error
If following error appears after adding the raspbian repository you need to add it’s key (wget https://archive.raspbian.org/raspbian.public.key -O – | apt-key add –):
W: GPG error: http://archive.raspbian.org/raspbian stretch InRelease: The follow ing signatures couldn't be verified because the public key is not available: NO_ PUBKEY 9165938D90FDDD2E<br> E: The repository 'http://archive.raspbian.org/raspbian stretch InRelease' is no t signed.<br> N: Updating from such a repository can't be done securely, and is therefore disa bled by default.
Missing Server JVM
Error: missing <code>server' JVM at</code>/usr/lib/jvm/java-8-openjdk-armhf/jre/lib/arm/server/libjvm.so'.<br>Please install or use the JRE or JDK that contains these missing components.<br>E: /etc/ca-certificates/update.d/jks-keystore exited with code 1.
Means that the package ca-certificates-java has not been installed. Fix by running apt install ca-certificates-java or apt install -f
Unifi dependency problems
dpkg: dependency problems prevent configuration of unifi:<br>unifi depends on binutils; however:<br>Package binutils is not installed.<br>unifi depends on jsvc (>= 1.0.8); however:<br>Package jsvc is not installed.
Means that the package jsvc has not been installed. Fix by running apt install jsvc or apt install -f
5 comments
Skip to comment form
Great tutorial, please provide the unifi controller update steps.
Author
Hi, Thanks for reading!
Updating is pretty easy:
1) Make sure to backup your configuration via the Unifi Controller
2) Download the latest setup package : wget https://dl.ui.com/unifi/5.11.50/unifi_sysvinit_all.deb
3) Install the downloaded setup package : sudo dpkg -i unifi_sysvinit_all.deb
Thanks this worked like a charm
Did not work for me on Odroid xu4 . Even after setting up the sources.list and adding the key, I get :
root@odroid:/etc/apt/sources.list.d# apt install mongodb-server
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mongodb-server : Depends: mongodb-server-core (>= 1:3.6.3-0ubuntu1.1) but it is not installable
Depends: mongodb-server-core (< 1:3.6.3-0ubuntu1.1.1~) but it is not installable
E: Unable to correct problems, you have held broken packages.
Author
Sounds like the raspbian repositories do not offer that version of mongodb-server anymore…