Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talcual/55f0b4022d4d0edb4038b3d400b72140 to your computer and use it in GitHub Desktop.
Save talcual/55f0b4022d4d0edb4038b3d400b72140 to your computer and use it in GitHub Desktop.
Installing Ubiquiti UniFi Controller 5 on Raspberry Pi.
# Mirror of the instructions available here:
# http://www.lowefamily.com.au/2016/06/02/installing-ubiquiti-unifi-controller-5-on-raspberry-pi/
#
# These commands CANNOT be run in a script.
# They're just for reference.
# Install on Raspbian Jessie, or upgrade from Wheezy.
# Make sure all packages are upgraded (update && upgrade).
# Update firmware.
sudo rpi-update
# Add the UniFi repository to the sources list, using the following commands
echo 'deb http://www.ubnt.com/downloads/unifi/debian unifi5 ubiquiti' | sudo tee -a /etc/apt/sources.list.d/ubnt.list > /dev/null
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv C0A52C50
sudo apt-get update
# Install unifi.
sudo aptitude install unifi
# Disable the default MongoDB database instance, using the following commands.
#
# Without making this small configuration change, you will have two separate
# instances of MongoDB running; an unused default database instance, and the
# UniFi database instance. This is obviously not desirable on a device with
# limited resources, such as the Raspberry Pi.
echo 'ENABLE_MONGODB=no' | sudo tee -a /etc/mongodb.conf > /dev/null
# For Raspberry Pi 1 devices:
#
# The latest UniFi Controller software requires some additional tweaking before
# it will run on ARMv6 devices, such as the original Raspberry Pi (RPi1).
# Remove the UniFi Cloud Library, using the following command:
sudo rm /usr/lib/unifi/lib/native/Linux/armhf/libubnt_webrtc_jni.so
# Update the Snappy Java Library, using the following commands:
cd /usr/lib/unifi/lib
sudo rm snappy-java-1.0.5.jar
sudo wget http://central.maven.org/maven2/org/xerial/snappy/snappy-java/1.1.2/snappy-java-1.1.2.jar
sudo ln -s snappy-java-1.1.2.jar snappy-java-1.0.5.jar
# Oracle Java 8 (Optional)
#
# The UniFi package automatically installs and configures
# OpenJDK Java 7. However, if you would prefer to use
# Oracle Java 8, perform the following steps.
# If needed (Raspbian Lite):
sudo aptitude install oracle-java8-jdk
# Copy the UniFi service controller template, using the following command:
sudo cp /lib/systemd/system/unifi.service /etc/systemd/system/
# Add the `JAVA_HOME` environment variable for Java 8 to the UniFi
# service controller, using the following command:
sudo sed -i '/^\[Service\]$/a Environment=JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt' /etc/systemd/system/unifi.service
# If you wish to switch back to Java 7 at any point, execute the following commands:
sudo rm /etc/systemd/system/unifi.service
sudo reboot
# Once completed, reboot your Raspberry Pi.
# When the reboot is complete, use a web browser to view HTTPS port 8443 on your Raspberry Pi:
# https://<raspberrypi>:8443
# Be sure there is enough disk space!
# If the server never starts up, try checking the log files:
#
# - /usr/lib/unifi/logs/mongod.log
# - /usr/lib/unifi/logs/server.log
#
# I had an issue where the disk was filled up before the DB could first be created.
# The symptom was mongodb logs indicated it wanted to upgrade the DB and exited.
# Removing the DB files and freeing up disk space fixed it after restarting unifi:
# sudo service unifi stop
# sudo rm /var/lib/unifi/db/*
# sudo service unifi start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment