Raspberry Pi (2011) model B as Unifi Controller

I have setup new networking equipment to provide a large upgrade to my home network. One component that was required was a small server to manage the access point, a Unifi AP AC Pro.

One option is to purchase a small device from Ubiquiti called a Cloud Key that has the management software pre-loaded. Another option is to install the management software on a Mac, PC, or Linux machine. However, that requires your personal computer to be on anytime you could want to use the software and is a lot of overhead.

I opted to go with a third option – using an old (generation 1) Raspberry Pi model B from 2011 and run the management software from that. I had one just sitting in my desk drawer unused, so it was a perfect opportunity!

To build my UnifiPi Controller (as I am calling it), I took information from two guides and merged them together as described below. This made for a very responsive dedicated device that works quite well!

  1. Begin by downloading and installing the latest Raspbian image from the Raspberry Pi website. This is outside of the scope of this article, but it is fairly trivial to do.
  2. Setup the Raspberry Pi using the raspi-config script. I highly recommend setting the proper keyboard layout for your region first, reboot, then change your passwords and configure the rest of the device defaults. I did the keyboard last and had issues logging in over ssh since the special characters on the default UK keyboard are in a different order than on a US keyboard layout!
    1. TIP: set the memory split to 16MB for the GPU. We’re using this in a headless environment, so wasting memory on the GPU is just going to hurt you.
  3. Fully update the Pi
    sudo aptitude update; sudo aptitude upgrade
  4. reboot
  5. Next fully update the firmware for your Pi
    sudo aptitude install rpi-update; sudo rpi-update
  6. reboot
  7. Set ssh to run on boot
    systemctl enable ssh
    systemctl start ssh
  8. Install and configure the Unifi software
    1. Add the repository
      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 aptitude update
    2. Install the software
      sudo aptitude install unifi
    3. Disable the default MongoDB or you’ll have two databases running wasting resources!
      echo 'ENABLE_MONGODB=no' | sudo tee -a /etc/mongodb.conf > /dev/null
    4. Update the Snappy Java Library as Unifi’s version is quite old
      cd /usr/lib/unifi/lib
      sudo mv snappy-java-1.0.5.jar snappy-java-1.0.5.jar.old
      sudo wget http://central.maven.org/maven2/org/xerial/snappy/snappy-java/1.1.2.6/snappy-java-1.1.2.6.jar
      sudo ln -s snappy-java-1.1.2.6.jar snappy-java-1.0.5.jar
    5. Remove the Unifi Cloud Library (ONLY NEEDED FOR ARMv6 devices – basically anything prior to the 3rd generation Pi)
      sudo rm /usr/lib/unifi/lib/native/Linux/armhf/libubnt_webrtc_jni.so
    6. Switch to the official Java client instead of OpenJDK. OpenJDK is horrible and resource intensive
      sudo aptitude install oracle-java8-jdk
      sudo update-alternatives --config java
      #Select Java8 - was item 2 for me
      java -showversion (to confirm it's set properly)
  9. reboot

You can now access the Raspberry Pi via the IP address pulled from DNS:
https://192.168.1.100:8443
ssh pi@192.168.1.100

Using the web interface running on port 8443 you can also configure any new Unifi APs.  You can also connect the Unifi iPhone app to manage your AP from your mobile device.  However, as I do not have a Unifi Secure Gateway, I am unable to get WAN/LAN stats.  But, I can get those separately through the EdgeRouter web UI.

Notes:

  • I decided to not setup a static IP address as I will use functions in my EdgeRouter Lite to set a static IP via MAC address.
  • I currently only have one Unifi AP but can expand to more as needed. However, given the size of my house and the location I was able to place the AP, that is unlikely to be needed.

Sources:
http://www.lowefamily.com.au/2016/06/02/installing-ubiquiti-unifi-controller-5-on-raspberry-pi/
https://www.youtube.com/watch?v=aZYGiZI48oc
https://www.raspberrypi.org/forums/viewtopic.php?f=81&t=101543


Posted

in

,

by

Comments

2 responses to “Raspberry Pi (2011) model B as Unifi Controller”

  1. Matt Avatar
    Matt

    I also have an old Pi 1 that I’m looking to run the controller on! What was your experience with it—are you still using it, and would you still recommend it?

    I would get an upgraded Pi or run it on another computer if I felt it was *that* important, but from what I can gather, the controller hardware has very little effect (if any) on the speed of the APs.

  2. KeithMcD Avatar

    I actually haven’t used that in about a year. I’ve got a newer setup using Docker on a Raspberry Pi 3 running four Docker containers. I’ve got a post I want to write on how to set this up, but it’s a much more elegant solution and drastically easier to keep up to date.

    Unfortunately, the Raspberry Pi 1 is just so old that it really may not be usable for the Unifi Controller at this point. It would be good for little hobby projects or something, however.

    I’ll try to get that Docker-based post up in the next few days!