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.
- 1 Install Dietpi
- 2 Install Unifi prerequisites
- 3 Unifi Controller Package:
- 4 Connect to Controller
- 5 Troubleshooting
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
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:
Make sure your Dietpi is up to date by issuing follwoing command:
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
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)
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 install mongodb-server
Test MongoDB installation with following command:
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:
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:
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
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:
To download and install packages using a proxy, you need to use following commands:
echo 'Acquire::http::Proxy "http://myproxy.mycompany.com:8080";' | tee /etc/apt/apt.conf.d/90-proxy
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