Installing Ubiquiti UniFi Controller 4 on Raspberry Pi

The Ubiquiti Networks UniFi Controller enables administrators to instantly provision and configure thousands of UniFi APs, allowing for quick, simple management of system traffic. A single UniFi Controller can manage multiple sites: multiple, distributed deployments and multi-tenancy for managed service providers.

This post describes how to install the UniFi Controller software Version 4 on Raspberry Pi.

The instructions in this article have been updated and tested with Raspbain Jessie (May 2016) and UniFi 4.8.18.

This article has been superseded by my new Installing Ubiquiti UniFi Controller 5 on Raspberry Pi guide. For specific instructions on how to upgrade your UniFi Controller software from Version 4 to Version 5, please refer here.

The UniFi Controller and mFi Controller software can co-exist on the same Raspberry Pi, however, you must be using Java 7 (default) and not Java 8.

Contents

134 comments

  1. After the upgrade to version 5, the controller is responding much slower to input commands thru remote desktop. Version 4 is much faster.
    I have not tried with connected keyboard and mouse on the PI-3.

  2. Jason,

    I followed the instructions as mentioned bij Chris (2016-06-02 at 2:14 pm) on PI-3. This is working very well.
    I upgraded from version 4 to version 5 .

  3. Hi Jason,

    Yes, just follow the instructions in the Updating and Upgrading section of the guide for instructions on how to upgrade from UniFi version 4 to UniFi version 5.

    You are on the right track – update the ubnt sources list from stable or unifi4 to unifi5, and then run the normal apt-get update/upgrade commands. This will perform an in-place upgrade to UniFi version 5.

    Hope that helps πŸ™‚

    Chris.

  4. I see Unifi version 5 just came out… anyone try updating/upgrading to this yet with the normal apt-get commands? I think in the instructions for 5.x you need to update the sources file but other than that should be a normal upgrade (from 4)

  5. Many thanks for this wonderfull tutorial and making my day. I was missing this and finally can save some money from power bills by running the controller on the Pi. Thanks million and making a difference to the world.

  6. Pi 2 with UniFi Controller 4.8.18. Instructions were flawless – everything worked as it should.

    I did notice that after the install of the UniFi software, it’s a good idea to watch the log to make sure it’s done creating the certificates before continuing. If it doesn’t finish this process, it screws up the software and it won’t start, which lead me to having to start over.

    I did “sudo tail /var/log/unifi/server.log” a few times after the UniFi software finished installing until I saw it get past the ” INFO system – Generating Certificate[UniFi]… please wait…” line. After that, rebooting is no problem.

  7. Chris,

    Thanks for the updated guide. I updated the OS and firmware then downloaded the new unifi 5.0.

    Everything went fine w/o issues. Also im running this on a RASPBERRY PI 2 MODEL B and it runs good.

  8. Hi Glenn,

    Yes, you will need root (or sudo) access to modify ubnt.list. It’s far easier to just SSH to your RPi using something like PuTTY, and then you can run shell commands directly.

    I’ve just updated this guide on how to upgrade to UniFi 5, plus finished a new UniFi 5 install guide.

    Kind Regards,
    Chris.

  9. Hi Chris,

    I am using WinSCP to access the files off rasp pi directories. Did navigate to /etc/… and now when i go to save the ubnt.list I get a permission denied error msg. I know its something to do w/ my user not set as root. I can’t figure how to get it to become root or create a new user w/ root access. (i’m new w/ linux stuff here.)

    Thanks

  10. Hi Glenn!

    I’m in the process of writing a new guide for UniFi 5 at the moment, which I hope to have ready (and tested) by later tonight.

    However, you should be able to upgrade from 4.x to 5.x by editing /etc/apt/sources.list.d/ubnt.list and changing the word stable to unifi5. Then run sudo apt-get update && sudo apt-get upgrade to perform the actual UniFi upgrade.

    Make sure to backup your UniFi configuration first however!! (and I should mention that I haven’t tested this myself yet either).

    Chris.

  11. Chris, ubnt just updated the unifi software to 5.0. Seems you can’t update to 5, so is it safe to follow the guide all over again just to update to newest version?

  12. Got this running on an original 256MB Raspberry Pi Model B after applying the snappy fix. Anyone had problems migrating access points to the new Rasp Pi controller? Originally showed as managed by other. Tried hard resetting access points as well as SSHing into the AP and using mca-cli to adopt.

    It shows as adopting for ages then disconnected.

    Putting them back on the original Windows unifi controller they get adopted in seconds.

    Any thoughts?

  13. Thanks for this explanation.
    I am a real newby. By just following this tutorial on a RP3 it works great for me.

  14. Thank you for the instructions, but I got one thing to add:
    The current debian install package for unifi contains one lib which causes trouble, at lease on a Rpi1:
    /usr/lib/unifi/lib/snappy-java-1.0.5.jar causes the system to hang as soon as there is some communication with any AP done.
    Fix: Change this lib to the latest version, keeping the original name.
    Maybe this will be fixed at some point in the package too.

  15. Many Thanks Chris,

    Bought a RPi 3 purely to run this controller as I have recently purchased an AP AC Pro. Followed your steps last night (03.May.2016) and it runs perfectly.

    Alex

  16. Ok for install controller 4 on a raspberry pi2 and I’ve just check and its work wonderfull. Anyone can help me for make a iso img file from this job ? I want to copy the controller unifi 4 on others rasp pi 2 quickly…

  17. Chris,

    I just picked up a Raspi 3 and have controller running on it. Is it possible to install pi-hole.net (Adblocking) on the Raspi and have both hosts running off it? If so then How can I install pi-hole app on it?

    Thanks

  18. Thanks for the writeup!
    Worked great a few weeks ago, now trying to run it again on a new unit and this command:
    sudo apt-get install unifi -y

    gives the message:
    E: Unable to locate package unifi

    No idea how to troubleshoot this.

    Thanks!

  19. I updated to 4.8.15 and its not working anymore.
    All the past fixes are not working anymore.
    This is not looking very reliable.
    If anyone gets away with updating let me know;)

  20. Hi all, I ran into some issues with my Chromecast 1, not being reachable in the mornings. So I posted a question on the unifi forum: https://community.ubnt.com/t5/UniFi-Wireless/ChromeCast-on-Unifi/td-p/771804/highlight/false/page/2

    Solution is to upgrade to 4.8.15 (the latest GA).

    I simply ssh’ed into my rpi2 and ran the frist 3 steps of page 3, and this seems to work, I am now on the lastest version. Now hopefully my problem will be solved too. πŸ˜‰

    BTW: you should first backup your config.

  21. Looks like I got it to work too.
    My current issue is, that when I start the controller with
    systemctrl start unifi
    the following line in /usr/lib/unifi/bin/unifi.init gets somehow ignored:
    JVM_OPTS=”${JVM_EXTRA_OPTS} -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Xmx384M”
    and the process still starts with -Xmx1024M parameter

    If i start it manually by executing
    java -Xmx384M -jar /usr/lib/unifi/lib/ace.jar start
    it runs with the -Xmx384M parameter as expected

    Any ideas ?

    P.S. Yes, updating the guide (and maybe the date of the post) would be great!

  22. It took me a whole afternoon to gather all the info from the comments to make it work, it would be nice to update the guide.
    I’m using an ARMv6 model B with UniFi 4.8.14.
    In summary, after following the guide:
    1. I used snappy-java-1.1.2.jar (see Julio’s comment)
    2. I removed Cloud Access (see Rich’s comment and UniFi release notes)
    3. I’m using java-8-openjdk-armhf, even if it works with 7 (stock) i find it faster, it’s just a feeling. I haven’t tried with Oracle’s because it’s good enough now, although it would be nice to find the best combinations of modules.

    Thanks to author of the guide and everyone who contributed.

  23. Hi, Chris, I too cannot get my Pi1 model B rev.2 to work using this guide.
    I would highly appreciate if you updated the guide with the workaround the Chris

  24. Hi Mike,

    Yes, it would be great to grab your manual from you! Thanks πŸ™‚ I’ll email you directly.

    Kind Regards,
    Chris.

  25. Hy Chris,

    sorry but i must tell you all that this manual does not work on Raspberry Pi 1. But i took a lot of time to analyze the problems and creating a successful workaround. If you want have my manual i will sent it to you?

    BR, Mike

  26. Hi

    I have followed your guide and installed unifi running java 8. But when I goto https://:8443I get:
    This site can’t be reached
    192.168.1.2 refused to connect.
    ERR_CONNECTION_REFUSED

  27. Thanks for the great guide! Being totally new to Linux and Raspberries, the controller was set up and working well in a jiffy.
    And another thank you for the comments’ contributors: without Leks’ information

    “– Uninstall unifi (sudo apt-get remove unifi)
    – Download previous version (wget http://dl.ubnt.com/unifi/4.7.6/unifi_sysvinit_all.deb)*
    – Install β€˜local’ package (dpkg -i unifi_sysvinit_all.deb)”

    4.9.1(alpha just to test DFS-channels with AC-Pro) would never have made made it to my P2

    * obviously substituted with “http://www.ubnt.com/downloads/unifi/4.9.1-691f5a97/unifi_sysvinit_all.deb”

    Kind rgds from AT
    Peter

  28. Hi Glenn,

    Upgrading is really easy – all you need to do is run the standard sudo apt-get update && sudo apt-get upgrade -y package upgrade commands. This will check for upgrades for all packages on your RPi. Alternatively, if you just want to upgrade the UniFi package, run the sudo apt-get install unifi -y command again.

    Kind Regards,
    Chris.

  29. Hi Micke,

    Ah, you beat me to it! My RPi3’s are still in the post!

    Thanks for letting me know πŸ™‚
    Chris

  30. Chris, thanks for the guide. I updated to .12 yesterday on the Pi2 w/o any issues and today I see there’s an update to .14. Whats the easiest way to update the controller on the Pi2?

  31. Just followed this guide for a fresh install on an RPi 3 (gave up after the last update on my RPi 1 B+, tried all the fixes below but just got constant restarts of Unifi).

    Guide works just fine on RPi 3. Up and running again! Thx!

  32. Thanks to all for your contributions. I have succesfully upgraded/migrated from 3.2.7 to 4.8.12 to enable use of the new AP AC Lite access points. My Pi2 was hanging and consuming 100% CPU. Thanks to Chris’s tutorial and the additional information provided by Rich and Juljo this is all working again fine.

  33. Have followed the guide twice now (RPi B+), still infinite loop, even though Rich and Juljos workarounds have been applied πŸ™

  34. Here also a successful 4.8.12 installation on a Pi 1, thanks to Chris’s tutorial + the info provided by Rich and Juljo. Thanks!

  35. I con conform that the info of Juljo and Rich cobined made 4.8.1.2 working on my pi 1. I could update without problems and everything is running stable so far for 2 days!

  36. Many many thanks. New to the PI2 and after 10 days of trying Noobs/ Wheezie and every guide available I finally rang Jessie new release last week 9/2/2016 and this tutorial is a literal copy and paste.
    Once again thank you .

  37. I was having issues after doing a clean install on my Pi and found out that there is a known issue with version 4.8.12 that causes it to fail to start on the Pi.

    The workaround at this time is to remove the Cloud Access native library by executing the following command:
    sudo rm /usr/lib/unifi/lib/native/Linux/armhf/libubnt_webrtc_jni.so

    Details of this release are available here:
    https://community.ubnt.com/t5/UniFi-Updates-Blog/UniFi-4-8-12-is-released/ba-p/1468911

  38. Fantastic tutorial. I had the same issue as Leks and Shannon. Leks’s solution fixed it for me. However, afterwards, I had to execute the following:

    echo “unifi hold” | sudo dpkg –set-selections

    This “pins” the old version of unifi so it won’t be replaced by the upgraded version next time I execute “apt-get upgrade”

  39. FYI Update:

    Leks, your modifications worked. I’m up and running.

    Thanks to both!

    -Shannon

  40. Yes, Fresh install of Jessie Lite. Nothing else installed.

    I’ve let it run for 48 hours now, and no change in condition. :/

    Thanks!

  41. Last weak Ubiquiti released a new version of the controller software (4.8.12) and that didn’t work on my gen 1 pi.
    After banging my head against the wall a couple of times, I tried the following:
    – Follow your tutorial to the letter (including installing Java8)
    – Uninstall unifi (sudo apt-get remove unifi)
    – Download previous version (wget http://dl.ubnt.com/unifi/4.7.6/unifi_sysvinit_all.deb)
    – Install ‘local’ package (dpkg -i unifi_sysvinit_all.deb)
    Et voila, the controller started running. I’m happy for now (sort of), hope it helps someone else.

    The question remains why the current version isn’t working. But let’s hope greater minds will solve that puzzle. πŸ™‚

  42. Hi Shannon,

    Interesting! Was this a fresh Jessie Lite install? Anything else running on your Pi1?

    I’ve actually ordered a Pi1B+ myself this week so I could see how UniFi runs on it, as I’ve has a few questions about using them recently (and unfortunately my old PiA refuses to boot!). Hopefully it will turn up shortly, and I can investigate further.

    Kind Regards,
    Chris

  43. Hi Chris,

    Seriously great tutorial, so I’m willing to bet this one is my fault, but I can’t figure this out for the life of me.

    System:
    Raspberry Pi 1B
    Jessie lite

    Installation all appeared to run successfully. However, when I attempt to open a browser on the 8443 port, I get a webpage not available, connection refused message like our friends below.

    The Pi is alive, as I can SSH to it successfully.

    I’ve left the Pi running overnight, and still had the same issue the next morning, so I don’t think it’s the building of the java or MongoDB we saw below.

    When I run sudo ps x -H -F or htop, I can’t find Unifi in the list anywhere.

    When I run “sudo /etc/init.d/unifi start” the system responds:
    [FAIL] Starting Ubiquiti UniFi Controller: unifi failed!

    And when I run “sudo /etc/init.d/unfiti stop” I get:
    [ ok ] Stopping Ubiquiti UniFi Controller: unifi (not running).

    Any ideas?

  44. How can I get the unifi controller to log to a remote system instead of logging to /var/log?
    I want to reduce the number of write to storage. In previous versions of Raspbian I used the ramlog package to write the logs to a tmpfs fs in RAM (but it doesn’t work on Jessie). Because of this I have been trying to use rsyslog to send the log files to a remote server but it doesn’t solve the problem because the unifi controller writes to it’s log file first then rsyslog sends it to the remote server. The only solution I can see is to modify /etc/init.d/unifi. Does anybody have any suggestions?

  45. Chris,

    I did reboot after the install. I’m running in on an RPi 1st gen I had laying around. Even running it overclocked it took that long.

    Anyways, excellent tutorial (the one on Ubiquiti’s site is ridiculous) and thanks to everyone for the suggestions.

  46. Hi Eric,

    Sorry I’m a bit late to this conversation, but glad you got it resolved! I’ve never seen it take that long before – did you reboot after installing Unifi? Are you using an RPi or and RPi2?

    Werner – Thanks for you comments also!

    Kind Regards,
    Chris

  47. Well, issue resolved.
    After a reinstall I was getting the same issue. Just on a whim I fired up a top session to see if anything was locking up the RAM or CPU and sure enough, Java was using all of the CPU, followed shortly by mongod. After letting it sit for a solid 30-45 minutes, lo and behold I can now access the webgui.

    I suppose this whole time I was just being impatient and Java hadn’t had time to create what it needed and mongo hadn’t finished it’s database quite yet.

  48. There’s no firewall in effect that would be blocking it. Unfortunately it never even gets the point of asking to trust the certificate as is normal with servers. I am on the same subnet. Configured the pi over SSH and am able to ping it just fine.

    I’m not well versed in Java but it appears as though there’s something going on with Java that is either not serving the page or denying access to it. If that’s the case, I’m not sure where to look to fix it. I did set it up first with Java 7 and then followed the directions to upgrade to 8 just in case that was the problem but saw no change.

    All packages are updated, only thing I can think is that possibly using the Lite distro is causing some sort of dependency issue, even though that should’ve been resolved during the package installs. I’ll download the full distro, retry, and report back.

  49. Eric,

    Are you sure there are no software firewall’s blocking you on the client side? Or maybe something with the https certificate that needs to be trusted? Are you on the same subnet or passing a router? Did you configure your rpi over the cli over the network or did you connect a screen & keyboard? Are you able to ping the rpi?

  50. My IP scheme is different but I’m attempting to access the same port (8443). I’m continually getting server cannot be reached with Safari or Firefox and Chrome responds as having the connection refused. Surely this is a permissions problem of some sort I’d assume.

  51. I’m having some issue accessing the webgui. I’ve followed the instructions to the T and still cannot seem to access the server. The unifi services are running, I’ve even had a go at accessing with http rather than https with no luck. Not sure what I’m missing here.

    Anyone else having this issue?

  52. Hi Chris,
    My problem is solved! Solution is on the UBNT forum but in a few words:
    – Upgrade form open JDK JAVA 7 to Oracle JAVA 8
    – Adjust heap size (XMX) to less then the 1Gb (for Rpi2 rev.B)
    – Don’t completly delete all files out of the portal map but add the custom ones and rename the old ones that have the same name to _old or _old

    Regards and again my compliments for your great website!
    Michel.

  53. Hi Chris,
    Thanks for your friendly reply to my question! I’ve been testing for 4 days now and made the following conclusions:
    – There seems no specific relation between expiration time and freez of portal page (sometimes it appears after 7 minutes and yesterday it was stable all day).
    – The (custom) portal page runs smoothly and stable on a windows 8 machine with Unifi controller installed
    – When it “hangs” on my Raspberry; the Raspberry and Unifi controller software are still accessible (I got a small printout of the log if you like) So controller SW and Raspberry are not going down; just the portal page is not visible anymore so not possible to accept terms and connect anymore. Without “Guest control settings” it seems to stays stable as well.

    I followed exactly your steps for installation and used FileZilla and SSH (PTTY) to replace the default portal page with my custom made one. Perhaps I need to search into the permission settings of that files?

    Again thanks for your respond and will place a request for help on UBNT as well.
    Regards,
    Michel.

  54. Hi Crisman,

    I suspect it was just a temporary server problem. Seems to be working fine for me at the moment.

    Kind Regards,
    Chris.

  55. Hi Michel,

    Apologies for not getting back to you sooner. I have been meaning to test this, but haven’t got around to it yet. If you haven’t already, I’d suggest that you post your question on the UBNT forums.

    Sorry I can’t be of more help!

    Kind Regards,
    Chris.

  56. Hi Chris,

    Thnaks for your instructions but I’m stuck at this point:

    pi@raspberrypi:~ $ sudo apt-key adv –keyserver keyserver.ubuntu.com –recv C0A52C50
    Executing: gpg –ignore-time-conflict –no-options –no-default-keyring –homedir /tmp/tmp.mN4TI6fBPR –no-auto-check-trustdb –trust-model always –keyring /etc/apt/trusted.gpg –primary-keyring /etc/apt/trusted.gpg –keyserver keyserver.ubuntu.com –recv C0A52C50
    gpg: requesting key C0A52C50 from hkp server keyserver.ubuntu.com
    gpg: keyserver timed out
    gpg: keyserver receive failed: keyserver error

    Could this be a temporary server problem?

  57. Hi Chris, First of all many thanks for this great website and tutorial to get Unifi running on a Pi. Followed your steps and it was easy to do.

    I do have a slight problem with guest control when set up a expiration time in the guest policy menu. When I set this to X hours; connected devices will disconnect perfectly after that time but is seems also the portal server goes down (http://192.168.1.10:8880/guest/s/default/). The Unifi controller webtool (:8443) is still accessible so Unifi is still running fine. No portal page available leads to no new login of devices to my wifi network. Is this a known issue? Can this be solved?
    Thanks in advance for an anwser. Regards, Michel

  58. Hi Chris,

    You are right. I am using Jessie Lite. Works fine now. Learning every day πŸ™‚
    Thanks for the help.

    Roelof

  59. Hi Roelof,

    You must be using Raspbian Jessie Lite, as this release does not include the rpi-update package. You just need to do a sudo apt-get install rpi-update to install the missing rpi-update package, and then retry sudo rpi-update again.

    To apply UniFi (and Raspbian) updates, all you need to do is run the standard sudo apt-get update && sudo apt-get upgrade -y package upgrade commands

    I will update the guide to include this info.

    Hope this helps!,
    Chris

  60. Hi Chris,

    Thanks for the guide! I am a Raspberry newbie. Following your guide installing was piece of cake.Only the command rpi-update did not work (invalid command.) Have to figure this out.
    When new versions or hotfixes of Unifi will be released, how can I install these?

    Kind regards

    Roelof

  61. Hi Werner,

    Thanks for your comments!

    Configuring a static IP address with Raspbian Jessie has changed. It is no longer done through /etc/network/interfaces, but instead through /etc/dhcpcd.conf. I’ve just posted a new guide:

    How to configure a static IP address on Raspberry Pi

    I don’t know much about KODI, but I can’t see a problem running both UniFi and KODI together on the same RPi2. UniFi is idle most of the time.

    Hope that helps! πŸ™‚
    Chris.

  62. Thanks for a great guide! I recently purchased a RPI2 with USB drive and installed the Unify 4 controller with your guide. I have 2 additional questions:

    1) How could I set fixed IP instead of DHCP? I tried to follow this guide: http://www.modmypi.com/blog/tutorial-how-to-give-your-raspberry-pi-a-static-ip-address
    But that doesn’t work … command cat /etc/network/interfaces returns “iface eth0 inet manual”. Not DHCP. Editing the mentionned files does not work. I tried through the GUI, and managed to set it fixed there, but there were no options for setting ipv6 for example.
    2) Is it possible to run KODI on the same RPI2? I read somewhere that Full HD requires 160 mb of gpu memory. But as far as I can see the RPI2 has enough memory to do both. Any experience on this. It seems the KODI package for Jessie is still experimental?

    Thanks again!

  63. Hi Hein,

    I’m glad you found my guide useful! πŸ™‚

    Sorry you are having problems after migrating your configuration over from a UniFi Controller on Mac. I am really not sure what to suggest, this is not normal behaviour (obviously!).

    I think you’ll need to ask the question over at the UBNT Community Forums – as this is outside my knowledge.

    Sorry I couldn’t help more!
    Chris.

  64. Hi Chris,

    I found your installation guide on the net and found it very useful. I could install my raspberian pi with the unifi controller easly with with your guide. Unfortunately I have a problem with the controller. I used to run the controller on a Mac. I than exported the backup-file and imported it into the controller at the pi. After couple of hours no one can connect. I see the devices but no clients. I run several different sites. Some are open, open with authentication or WPA protected. The accesspoints are on different locations and they connect over the web (Layer-3).
    When I stop/start the service everything works fine for a certain amount of time.
    What could be the problem?
    I’m pretty new that Linux stuff…

    Thanks for your help.
    Hein

  65. Thank you for the tutorial and the fact I didn’t have to mess with init.d/systemctl unit script manually made me happy πŸ™‚ Thanks!

  66. Hi Paul!

    I suspect you’re still using Raspbian Wheezy, rather than the newer Raspbian Jessie. I have recently updated the instructions for Jessie, as it simplifies the entire UniFi install process significantly. I’ve just run through the instructions myself this morning without any problems.

    In the first instance, I would recommend rebuilding your Pi using Raspbian Jessie if you can. Otherwise, it is possible to upgrade from Wheezy to Jessie (see my Upgrading Raspbian Wheezy to Jessie guide, but it is very time consuming (3+ hours). But probably the easiest thing to do if you want to stay with Raspbian Wheezy would be to just follow the MongoDB install instructions from my Installing Ubiquiti mFi Controller 2 on Raspberry Pi guide. I haven’t got around to updating them for Jessie yet!

    I also haven’t updated my Installing Ubiquiti UniFi Controller 4 on Raspberry Pi Youtube video, which still shows the Raspbian Wheezy instructions.

    Hope than helps!
    Kind Regards
    Chris.

  67. Great tutorial, already worked for me once, however this time I got the following:
    Is there something I’m missing?

    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:
    unifi : Depends: mongodb-10gen (>= 2.0.0) but it is not installable or
    mongodb-server (>= 2.0.0) but it is not installable
    E: Unable to correct problems, you have held broken packages.

  68. Thanks for a great tutorial. I managed to install the controller on my pi and move the setup using a backup from my windows computer. Now I am trying to follow the instructions on
    http://community.ubnt.com/t5/tkb/articleprintpage/tkb-id/UniFi_FAQs@tkb/article-id/77
    to disable selfrun guest mode on my APs. However, I have trouble finding the directory on my pi. Anyone knows where that is (I guess it is the directory where all unifi files are installed)?
    (I guess the alternative is to ssh into the APs and configure them separately, I only have two so it is not much of a problem really).

  69. You’re right. After some digging I found that /etc/resolv.conf was empty. Seems like it gets no info from router, because it’s empty after each reboot. In addition to this I had some corrupted package list files… Now I was able to install unifi. Unfortunately I get a segmentation fault on startup… Guess I reinstall Raspbian and start over.

    Thanks for prviding the instructions and helping! πŸ™‚

  70. Hi Oystein,

    You appear to have a name resolution problem – the log indicates you can’t even get to the normal Raspberry Pi or Raspbian repositories.

    Can you ping anything using a name?

    I did also check the UBNT URL’s and keyserver – no they haven’t changed recently.

    Kind Regards,
    Chris.

  71. I am having trouble adding the repository to source tree. Are the URL’s out of date?

    sudo -i
    root@UniFiPi:~# echo “deb http://dl.ubnt.com/unifi/debian/dists/stable/Release stable ubiquiti” > /etc/apt/sources.list.d/unifi.list
    root@UniFiPi:~# apt-key adv –keyserver keyserver.ubuntu.com –recv C0A52C50
    Executing: gpg –ignore-time-conflict –no-options –no-default-keyring –homedir /tmp/tmp.fW1BAa806Z –no-auto-check-trustdb –trust-model always –keyring /etc/apt/trusted.gpg –primary-keyring /etc/apt/trusted.gpg –keyserver keyserver.ubuntu.com –recv C0A52C50
    gpg: requesting key C0A52C50 from hkp server keyserver.ubuntu.com
    ?: keyserver.ubuntu.com: Host not found
    gpgkeys: HTTP fetch error 7: couldn’t connect: Connection refused
    gpg: no valid OpenPGP data found.
    gpg: Total number processed: 0
    root@UniFiPi:~# apt-get update
    Err http://mirrordirector.raspbian.org jessie InRelease

    Err http://mirrordirector.raspbian.org jessie Release.gpg
    Could not resolve ‘mirrordirector.raspbian.org’
    Err http://dl.ubnt.com stable InRelease

    Err http://archive.raspberrypi.org jessie InRelease

    Err http://dl.ubnt.com stable Release.gpg
    Could not resolve ‘dl.ubnt.com’
    Err http://archive.raspberrypi.org jessie Release.gpg
    Could not resolve ‘archive.raspberrypi.org’
    Reading package lists… Done
    N: Ignoring file ‘unifi.listsudo’ in directory ‘/etc/apt/sources.list.d/’ as it has an invalid filename extension
    W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/jessie/InRelease

    W: Failed to fetch http://archive.raspberrypi.org/debian/dists/jessie/InRelease

    W: Failed to fetch http://dl.ubnt.com/unifi/debian/dists/stable/Release/dists/stable/InRelease

    W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/jessie/Release.gpg Could not resolve ‘mirrordirector.raspbian.org’

    W: Failed to fetch http://dl.ubnt.com/unifi/debian/dists/stable/Release/dists/stable/Release.gpg Could not resolve ‘dl.ubnt.com’

    W: Failed to fetch http://archive.raspberrypi.org/debian/dists/jessie/Release.gpg Could not resolve ‘archive.raspberrypi.org’

    W: Some index files failed to download. They have been ignored, or old ones used instead.
    root@UniFiPi:~# exit

  72. Thank you Chris for your help
    Your website helped me to much
    It’s was so easy to do for the first time people use raspberry pi like me

    So big thanks to you πŸ™‚

    Have a good time

  73. Hi Vas,

    No worries!

    You can call the Unifi service controller script using the following command:
    sudo /etc/init.d/unifi
    This command will show you the service controller usage, which looks like this:
    [ ok ] Usage: /etc/init.d/unifi {start|stop|restart|reload|force-reload}.

    To Start the Unifi service, use sudo /etc/init.d/unifi start
    To Stop the Unifi service, use sudo /etc/init.d/unifi stop

    However, if you want to stop the Unifi service from automatically starting at boot, you need to make a one line change to Unifi service controller script.
    sudo nano /etc/init.d/unifi
    Look for the following line:
    ENABLE_UNIFI=yes
    Change it to:
    ENABLE_UNIFI=no

    Hope that help! πŸ™‚
    Chris

  74. Hi.
    i check it again and i found the solution….my mistake on browser and port 8443.
    anyway sorry

    by the way how can i manually start and stop the Unifi controller?

    for example i dont want to start automatically on reboot the controller and i want to start manually and stops latter.

    Thank you again

  75. Hi Yaser,

    To get back to a headless configuration from desktop, just run the Raspberry Pi Configuration GUI tool and change the Boot option to CLI, and set GPU Memory to 16 MB. From the next reboot, you will be back to a headless (CLI) configuration.

    I’ve just finished a new guide for the Raspbian Jessie Raspberry Pi Configuration Tool (GUI).

    In terms of the number of APs a Raspberry Pi can manage, I am led to believe it is thousands. Once you’ve setup an AP, the UniFi Controller is mostly passive in that it doesn’t do much except gather stats – in fact you can even turn it off if you don’t care about the stats.

    Kind Regards,
    Chris

  76. please forget the qusiton about moving the unifi controller from PC to raspberry pi
    because i did it now and its working great

    i did normal restore to raspberry thru the browser

    thx

  77. hi

    first thank you for your great website u helped me a lot !

    i have 3 questions please

    1- i have raspberry pi 2 1G ram
    i installed the unifi every thing was fine and it was working headless
    then i change the setting back to start raspberry pi to desktop and changed ram back to 64
    and now i don’t know how to get it back to headless !

    2-i have PC running unifi controller i want to move it to the raspberry pi
    i have copy of the setting how to restore to unifi controller in raspberry while there’s no GUI unifi to restore

    3- finally how many aps can unifi controller handle in raspberry pi
    i have about 20 aps and about 15 user, is the raspberry pi can handle without any problem ? or i should move unifi controller to more powerful desktop like mac mini

    thank you

  78. Excellent to hear Neil, glad we could work that through together πŸ˜‰

    Always happy to try to help!!

    Chris.

  79. Quick update from my end… My RPi2 has been up >5 days and still running strong. I am running Unifi 4.7.5, WebIOPi 0.7.1, Apache, and NUT (Network UPS Tools); everything is running smoothly.

    Thank you again, Chris, for the great write-up. And for your patience with me, and others! πŸ™‚

    Best regards,

    Neil

  80. Hi Vas,

    Did you export your UniFi 3.6.6 settings and then import them into UniFi 4.7.5?

    Are you using Java 7 or Java 8?

    Are you running anything else on your Raspberry Pi? Another Web Server?

    What type of Rasberry Pi? Is it overclocked?

    Sorry, I can’t really be of more help.
    Chris.

  81. I have to apologise Neil, you are correct! I do have three UniFi processes running, however, it’s not all bad!

    I had been using top -c which shows the busiest processes first, and the other two UniFi processes were way down the list as they do not use any CPU or memory.

    Using sudo ps x -H -F I can see all three UniFi processes, and I can see they are hierarchical sub-processes.

    SZ is the Virtual memory assigned to a process.
    RSS is the Real memory assigned to a process.

    The first UniFi process has the Ss status flags, which means the process is in an interruptible sleep (waiting for an event), and is the session leader (the parent process). SZ is ~0.5KB, RSS is ~0.1KB, TIME is 0:00 – so this process is negligible.

    The second UniFi process has the S status flag, which means the process is in an interruptible sleep (waiting for an event). SZ is ~0.5KB, RSS is ~0.1KB, TIME is low – so again this process is negligible.

    The third UniFi process has the Sl status flags, which means the process is in an interruptible sleep (waiting for an event), and is multi-threaded. On a clean install, SZ is ~275MB, RSS is ~28MB. This process seems to be just a wrapper or controller which launches the main Java application sub-process (using a hard coded -Xmx1024M as far as I can tell). On my production UniFiPi 4.6.6, memory usage of this process has only increased marginally over the past four months.

    The main Java application process, has the Sl status flags, which means the process is in an interruptible sleep (waiting for an event), and is multi-threaded. The Java application also launches the MongoDB database instance. On a clean install, SZ is ~290MB, RSS is ~80MB. On my production UniFiPi 4.6.6, which has an uptime of 101 days, SZ is ~465MB, RSS is ~175MB and TIME is 10392:46.

    The Mongo database instance has the Sl status flags, which means the process is in an interruptible sleep (waiting for an event), and is multi-threaded. On a clean install, SZ is ~51MB, RSS is ~85MB. On my production UniFiPi 4.6.6, which has an uptime of 101 days, SZ is ~85MB, RSS is ~148MB and TIME is 1290:16.

    So… in terms of CPU utilization, everything sleeps until a new incoming connection is made – at which point the relevant processes return to a running state. In terms of memory utilization, it seems to look “good” from what I can tell and from my testing. I’m not sure what the second UniFi process is for, maybe it is the listener for the inform process on port 8080 (just a guess).

    Something you’ve alerted me to is the unifi.db.nojournal option. I did test this a couple of days ago, but somehow had convinced myself this was already the default setting. I have now realised in my testing today it is still turned on. I will update the guide again! πŸ™‚

    Hope this info is helpful!

  82. Thanks for the updated instructions, Chris.

    I reinstalled Rasbian Jessie from scratch and followed your instructions again (with the updated MongoDB steps :)) and I still see three unifi processes running when i run “sudo ps x”. I tried with your updated method for creating a symbolic link to Java 8 and reverting back to the bundled Java 7, both with the same result.

    564 ? Ss 0:00 unifi -home /usr/lib/jvm/java-7-openjdk-armhf -cp /usr/share/java/commons-daemon.jar:/usr/lib/unifi/lib/ace.jar -pidfile /var/run/unifi/unifi.pid -procname unifi -outfile SYSLOG -errfile SYSLOG -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Xmx1024M com.ubnt.ace.Launcher start

    565 ? S 0:00 unifi -home /usr/lib/jvm/java-7-openjdk-armhf -cp /usr/share/java/commons-daemon.jar:/usr/lib/unifi/lib/ace.jar -pidfile /var/run/unifi/unifi.pid -procname unifi -outfile SYSLOG -errfile SYSLOG -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Xmx1024M com.ubnt.ace.Launcher start

    567 ? Sl 0:02 unifi -home /usr/lib/jvm/java-7-openjdk-armhf -cp /usr/share/java/commons-daemon.jar:/usr/lib/unifi/lib/ace.jar -pidfile /var/run/unifi/unifi.pid -procname unifi -outfile SYSLOG -errfile SYSLOG -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Xmx1024M com.ubnt.ace.Launcher start

    653 ? Sl 0:52 /usr/lib/jvm/java-7-openjdk-armhf/jre/bin/java -Xmx1024M -Dapple.awt.UIElement=true -jar /usr/lib/unifi/lib/ace.jar start

    672 ? Sl 0:02 bin/mongod –dbpath /usr/lib/unifi/data/db –port 27117 –logappend –logpath logs/mongod.log –nohttpinterface –nojournal –smallfiles –bind_ip 127.0.0.1

    The only additional steps I did, outside of your guide, was adding the following lines to /var/lib/unifi/system.properties (but this was done after confirming the three instances of unifi were running):
    unifi.db.extraargs=–smallfiles
    unifi.db.nojournal=true

    I’m not sure where to go from here. I will leave it running to see if it’s stable now. But I can see just in the few minutes I was writing this reply my free memory has steadily gone down 14MB and counting…

  83. Hi , thank you for all infos

    I make clean install jessie on my raspberry pi (the old one) i use it until now with old 3.6.6 unifi controller without problems .
    Your instructions makes easier to install new version of Rasbian Jessie with UniFi controller.
    Works great for 1 or 2 hours. After maybe 1 or 2 reboots
    i receive in
    HTTP Status 400- type status report
    description The request send by the client was syntactically incorect
    Apache Tomcat/7..0.50
    Why?
    How can i fix it?
    Thank you again

  84. Hi Neil,

    Yeah, that full Unifi command-line is pretty long. I was looking at that last night also, had to maximize the ssh terminal window across two monitors!

    I have no idea why you have 3 UniFi processes running (PIDs 569/570/571) – that is certainly not normal! The fourth Java process (PID 791) is the jsvc launcher (it also seems to use -Xmx1024M for itself).

    FYI, to disable the default instance of MongoDB via configuration file on Raspberry Pi, add “ENABLE_MONGODB=no” to /etc/mongodb.conf (took a bit of trial and error to work out).

    My “production” Raspberry Pi 2 with UniFi has been rock solid stable for many months now – it is still running Raspbian Wheezy and UniFi 4.6.6 – which included Java 6 (I do plan to rebuild it soon). However, I have a couple of development Pi 2’s running Raspbian Jessie and UniFi 4.7.5 with Java 7 / 8 and they both ‘seem’ just as stable, although I only have a couple UniFi AP AC devices attached for testing.

    It’s probably worth rebuilding your Raspberry Pi to clean it up and starting again. It should be stable 24/7. I don’t believe the SD card usage is all that high under normal circumstances.

    I’ve refined my instructions for switching to Java 8, which don’t require any changes to unifi.init (that way it won’t be affected by package updates (apt-get upgrade) in the future).

    # Create a Symbolic Link to trick unifi.init into thinking Java 6 is installed (actually Java 8)
    sudo ln -sf jdk-8-oracle-arm-vfp-hflt/jre /usr/lib/jvm/java-6-openjdk-armhf
    # Reset the default JRE to Java 8
    sudo update-alternatives --set java /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/jre/bin/java
    # Reboot for changes to take affect
    sudo reboot

    You can also easily and cleanly switch back to Java 7 by doing:

    sudo rm -f /usr/lib/jvm/java-6-openjdk-armhf
    sudo update-alternatives --auto java
    sudo reboot

    UBNT state that they fully support Java 8, however, I’m still undecided if “I” will use Java 8 or use the bundled version of Java 7! More testing required.

    Chris

  85. Hi Chris,

    So, upon further inspection, it does appear the Xmx value is being used in the unifi.init script. I wasn’t able to see it in the output of “sudo ps x” because my Putty window wasn’t wide enough to see the whole command that was running. But you can see from the output below it is respecting the “Xmx-256M” value I put in the unifi.init script. However, that raises another question; is this what everyone’s looks like?? It appears unifi is running three times (all with the 256M value I entered) and then some sort of fourth instance of ace.jar being launched, which is still using the 1024M value. I have to admit, that I am very green when it comes to Linux OS’s, so I really don’t know if this is to be expected or not — it just seemed weird to me that it was running three times. And I also see in the mongodb log that there are always 3 active connections to it…

    569 ? Ss 0:00 unifi -home /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/jre -cp /usr/share/java/commons-daemon.jar:/usr/lib/unifi/lib/ace.jar -pidfile /var/run/unifi/unifi.pid -procname unifi -outfile SYSLOG -errfile SYSLOG -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Xmx256M com.ubnt.ace.Launcher start

    570 ? S 0:00 unifi -home /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/jre -cp /usr/share/java/commons-daemon.jar:/usr/lib/unifi/lib/ace.jar -pidfile /var/run/unifi/unifi.pid -procname unifi -outfile SYSLOG -errfile SYSLOG -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Xmx256M com.ubnt.ace.Launcher start

    571 ? Sl 1:09 unifi -home /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/jre -cp /usr/share/java/commons-daemon.jar:/usr/lib/unifi/lib/ace.jar -pidfile /var/run/unifi/unifi.pid -procname unifi -outfile SYSLOG -errfile SYSLOG -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Xmx256M com.ubnt.ace.Launcher start

    791 ? Sl 10:19 /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/jre/bin/java -Xmx1024M -Dapple.awt.UIElement=true -jar /usr/lib/unifi/lib/ace.jar start

    841 ? Sl 7:34 bin/mongod –dbpath /usr/lib/unifi/data/db –port 27117 –logappend –logpath logs/mongod.log –nohttpinterface –nojournal –smallfiles –bind_ip 127.0.0.1

    I WAS going to tell you that over the last three days my RPi2 has hung/crashed once per day but from yesterday to today it had not (which I thought would be a good sign of the couple changes I made). But, as I was writing this reply and pulling some of the data off of it, it crashed! I’ve had a ssh session open constantly for the last 3-4 days running top so that at least when it crashed I could see the current CPU and Mem usage, and every other day the memory usage has bee high (~16MB free) but today there was ~480MB free. So now I have no idea what’s going on!

    I have noticed that the activity light is pretty much always on/green since installing unifi/mongodb, and read that high SD card usage can cause corruption and/or crashes. Do you find with unifi (and mongodb) running on your Pi that the SD card usage is high?

    I would love to get this figured out, but I’m tempted to just run Unifi on my Windows machine which is on 24/7 anyways. I can’t afford to have my Pi crashing every day or so, as it runs other Home Automation scripts that I rely on.

    Any insight into how your Pi (or others) are running since installing Unifi would be appreciated — just so I know if it’s just mine and perhaps I need to start over since others are working without issue. Do you use your own optional java 8 instructions or do you stick with the bundled java 7 jre?

    Thanks,

    Neil

  86. Thanks for the feedback Neil! Much appreciated πŸ™‚

    Yes, I’ve had a few questions about the additional default instance of MongoDB just recently, and your info will help solve that! Excellent, I will update the guide, thanks.

    Unfortunately the /usr/lib/unifi/bin/unifi.init script doesn’t call Java to start Unifi directly, it instead calls jsvc (a Java service controller) with various arguments including the full path to /usr/lib/unifi/lib/ace.jar and other jvm options such as -Xmx1024M. It’s possible that jsvc is not passing or ignoring the -Xmx argument?

    Were you meaning that you can start UniFi manually with -Xmx512M and that works, but not when launched through a modified UniFi.init script?

    Thanks again Neil!
    Chris.

  87. Hello Chris,

    First, I want to thank you for a very well written how-to; I was able to follow it with no issues and had a *working* setup in minutes!

    I use asterisks around “working” because I have come across a couple issues that I’m hoping you may be able to help with before I consider this a production ready (and by production ready, I mean using it for a single UAP setup in my house :P). First, is the fact that the default install of MongoDB that’s included with UniFi auto-starts the “default instance”, so there are always two mongodb processes running. Normally I don’t think that would be a big deal, but since we’re running this on a resource-limited piece of hardware, reducing the amount of running processes is ideal. I found others who came across this and they recommended to update the /etc/init/mongodb.conf file (change ENABLE_MONGODB=”yes” to ENABLE_MONGODB=”no”). I made this change but the service was still starting on reboot so I ran “sudo update-rc.d mongodb disable” and now there’s only ever one instance of mongodb running, which is the one that unifi starts.

    The second, and more concerning, issue is the java heap size unifi uses. By default, it is allocating 1024M (as seen in /usr/lib/unifi/bin/unifi.init), and the RPi2 only has 1GB to begin with. Others suggest to change “-Xmx1024M” to “-Xmx512M” or “-Xmx256M”, which I have tried. The problem seems to be that unifi is not respecting this config file and not using the new xmx setting when starting java. You can see that it’s still using 1024M to start even though i’ve changed the value in the unifi.init file.

    /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/jre/bin/java -Xmx1024M -Dapple.awt.UIElement=true -jar /usr/lib/unifi/lib/ace.jar start

    I am still trying to figure out how to get unifi to use this new xmx value, but figured i’d reach out to see if you or anyone else using your guide has come across this already.

    Thanks again for the great write-up!

    Neil

  88. Hi Stephen,

    Yes, in theory you can use my Upgrading Raspbian Wheezy to Jessie guide, and this will include all components including MongoDB and UniFi (assuming you have added UniFi repository to the sources list). You shouldn’t need to kill either of these processes.

    However, it is a very long process (about 3 hours!). Honestly, you are probably better off backing up your UniFi configuration (UniFi > Settings > Maintenance > Services > Download Backup Settings), rebuilding directly to Raspbian Jessie with UniFi 4.7.5, and then restoring your configuration from backup (about 30 minutes). There is an option to “restore from a previous backup” on the first UniFi Setup Wizard page, or you can do it after UniFi Setup is complete from UniFi > Settings > Maintenance > Restore.

    In short, no you don’t need Java 8. The UniFi package automatically installs Java 7 OpenJDK as a prerequisite, but Ubiquiti Networks do state that UniFi is fully compatible with Java 8. Raspbian Wheezy and Jessie does include a Raspberry Pi optimised version of Oracle Java 8 in the image, which has some performance improvements over Java 7 OpenJDK.

    I will update the guide to clarify these points better.

    Hope that helps! πŸ™‚

    Chris.

  89. These instructions worked great. But now that updates/upgrades are available for both and the full instructions are updated, do you have any for updating systems that are already running?

    I’m assuming that I can use the instructions for updating raspbian to jessie, but do I need to kill the mondodb and unifi services first? If that works can I just run the unifi scripts again to update that as well? Do I need Java 8?

    Or am I just better off starting over from the beginning? Although the java 8 question still stands there.

    Thanks.

  90. Hi Flip,

    The most common reason for people having trouble with MongoDB installs on Raspberry Pi seems to be related to non-English Locale settings in raspi-config. Try changing your locale to either en_GB or en_US and install MongoDB. You can change your locale back after you’ve installed MongoDB.

    Steps:

    sudo raspi-config

    4 Internationalisation Options

    I1 Change Locale

    Select en_GB.UTF-8 UTF8 or en_US.UTF-8 UTF-8

    Hope that helps! πŸ™‚
    Chris

  91. I followed all the steps on my RPi 2, but getting the error:

    pi@RPi ~ $ sudo apt-get install mongodb -y
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following package was automatically installed and is no longer required:
    libgssglue1
    Use ‘apt-get autoremove’ to remove it.
    The following NEW packages will be installed:
    mongodb
    0 upgraded, 1 newly installed, 0 to remove and 693 not upgraded.
    1 not fully installed or removed.
    Need to get 0 B/12.1 kB of archives.
    After this operation, 18.4 kB of additional disk space will be used.
    Selecting previously unselected package mongodb.
    (Reading database … 89971 files and directories currently installed.)
    Unpacking mongodb (from …/mongodb_1%3a2.4.10-5_armhf.deb) …
    Setting up mongodb-server (1:2.4.10-5) …
    [FAIL] Starting database: mongodb failed!
    invoke-rc.d: initscript mongodb, action “start” failed.
    dpkg: error processing mongodb-server (–configure):
    subprocess installed post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of mongodb:
    mongodb depends on mongodb-server (>= 1:2.4.1-2); however:
    Package mongodb-server is not configured yet.

    dpkg: error processing mongodb (–configure):
    dependency problems – leaving unconfigured
    Errors were encountered while processing:
    mongodb-server
    mongodb
    E: Sub-process /usr/bin/dpkg returned an error code (1)

  92. I’m following al the steps to install the MongoDB on my RPi 2

    But get this error

    Setting up mongodb-server (1:2.4.10-5) …
    [FAIL] Starting database: mongodb failed!
    invoke-rc.d: initscript mongodb, action “start” failed.
    dpkg: error processing mongodb-server (–configure):
    subprocess installed post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of mongodb:
    mongodb depends on mongodb-server (>= 1:2.4.1-2); however:
    Package mongodb-server is not configured yet.

    dpkg: error processing mongodb (–configure):
    dependency problems – leaving unconfigured
    Errors were encountered while processing:
    mongodb-server
    mongodb
    E: Sub-process /usr/bin/dpkg returned an error code (1)

  93. Dear Chris,
    Just got my PI2 working with the unifi sw with the great help of your post! My question to you is were I can find (and edit) the portal page (were to accept the agreement or voucher etc.) on the SD Card? I’m more into Windows so I guess it’s a map or so? Regards and thanks for reply, Michel

  94. Hi Stevo,

    Ideally they should install under /opt, however, the apt-get packages for mongo and unifi default to installing under /user/bin. I don’t know the reason why they chose this location, and I’m not aware of any way to override it either unfortunately.

    If you look at my mFi Controller Guide, you’ll see that I install the mFi binaries under /opt because there is no installer, just a zip.

    Hope that answers your question!?

    Kind Regards,
    Chris.

  95. Hi Chris,

    New to Linux and just followed your post against all other Unfi to Pi install methods. Just wanted to get an idea why the /opt dir was not the default install location for unifi and mongo? What determined where these were to be installed using your method.

    Thanks in advance.

  96. Hi,
    great installation instruction.
    Very useful for raspi dummys like me.

    I have some issue with the alerts.
    if i disconnect/Connect a ap the alert list are empty.
    at the events page i can see that the ap was disconectet.

    I have make something wrong?

    greetings Hendrik

  97. Thank you for the instructions. I had some locale issues while installing the mongodb. Solved them by changing the locale to “en_US.UTF-8”. Other than that the provided steps worked fine for me with the current “RASPBIAN – Debian Wheezy” on the “Raspberry Pi 2 Model B”.

    Cheers

  98. Hi again,

    Thanks for your pointers! It turned out to be pretty easy to change the port in domoticz instead. Once done everything works perfect even after a reboot.

    Johan

  99. Hi Johan,

    I think the domoticz server is still going to cause you some problems even if you start UniFi first. UniFi also uses port 8080 for device inform (discovery), and it looks like domoticz has grabbed that port, so I would think you would have trouble adopting/finding devices in UniFi Controller.

    It is possible to change the ports that the UniFi Controller uses by editing the /usr/lib/unifi/data/system.properties file, however, if you change the device inform port, I would assume you would also need to SSH into all your UniFi devices and run a set-inform command to tell them of the new port to contact the Controller on – probably not desirable.

    For a list of ports that the UniFi Controller uses, see:
    https://community.ubnt.com/t5/UniFi-Frequently-Asked-Questions/UniFi-What-are-the-default-ports-used-by-UniFi/ta-p/412439

    If you do want to try changing the start order of the two services, have a look at this site for some help:
    http://www.jamescoyle.net/cheat-sheets/791-update-rc-d-cheat-sheet

    Good Luck! πŸ™‚
    Chris

  100. Hi Chris,

    Thanks for a great tutorial! I followed it and everything went smooth from an installation standpoint. My only problem was that Unifi didn’t seem to start properly. See netstat output:
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 2402/domoticz
    tcp 0 0 0.0.0.0:6144 0.0.0.0:* LISTEN 2402/domoticz
    tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 2063/mongod
    tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN 2409/Xtightvnc
    tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 2402/domoticz
    tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN 2409/Xtightvnc
    tcp 0 0 127.0.0.1:28017 0.0.0.0:* LISTEN 2063/mongod
    tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2353/sshd

    The problem for me is that I’m running a domoticz server on the Pi too. So I turned the domoticz service off, restarted the Unifi service, and the domoticz service too. By doing that everything seems to be working fine again:

    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 0.0.0.0:8443 0.0.0.0:* LISTEN 3017/java
    tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 3039/domoticz
    tcp 0 0 0.0.0.0:6144 0.0.0.0:* LISTEN 3039/domoticz
    tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 2065/mongod
    tcp 0 0 0.0.0.0:8843 0.0.0.0:* LISTEN 3017/java
    tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN 2428/Xtightvnc
    tcp 0 0 127.0.0.1:27117 0.0.0.0:* LISTEN 3089/mongod
    tcp 0 0 0.0.0.0:8880 0.0.0.0:* LISTEN 3017/java
    tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 3039/domoticz
    tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN 2428/Xtightvnc
    tcp 0 0 127.0.0.1:28017 0.0.0.0:* LISTEN 2065/mongod
    tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2367/sshd

    I just wanted to let you know in case someone else runs into a similar problem. I haven’t yet figured out how to make this work after a reboot. The Unifi service needs to be started before the domoticz one.

    Thanks
    Johan

  101. Hi Steve, no worries.
    I don’t currently have anything on WLAN based scheduling at the moment, however, I am in the process of writing a UniFi CLI reference article – hopefully I will be able to work out what commands Ubiquiti use to implement WLAN scheduling from the UniFi Controller GUI, so then I can include it in the CLI reference.

  102. Extra thanks for update and instructions for keeping controller updated! Worked perfectly on my Pi2 on my USG and AP-ACv2.

    PS. You don’t happen to have any links for how to run WLAN based scheduling beyond that provided in the Controller GUI ?!!

  103. Hi Chirs,

    I mentioned keyboard and mouse because I had in the first place the graphical interface activated and when connecting/seeing it, was also frozen, but some services were still running like the UniFi.
    Then I set it to 16MB and deactivated the graphical interface an disconnected the mouse, keyboard, etc..

    Good question about the link! When I used it was very late in the night, I’m not sure but I remember changing all that says UniFi to mFi. I also remember to see in other posts that the download link was debian version, the unix version on the Ubnt download page.
    On the Ubnt instructions page the link is: sudo wget http://dl.ubnt.com/mfi/3.X.X/mFi.unix.zip
    https://community.ubnt.com/t5/mFi-Frequently-Asked-Questions/Installing-the-mFi-Controller-on-Raspberry-Pi/ta-p/1129462

    Renato

  104. Hi Renato,

    Having the memory split set to 16MB is only recommended if you haven’t got a local monitor/keyboard/mouse attached to your Pi (headless configuration). You said in your earlier post about the mouse, keyboard, monitor looking like it was frozen which makes me wonder if you should try increasing the GPU memory split back to the default value of 64MB. I’m just guessing, but its easy to try.

    I’ve been trying to install mFi myself, but can’t seem to find the mFi package when I just change the UniFi download link to mFi. What download link did you use to install mFi on the Raspberry Pi?

    Kind Regards,
    Chris.

  105. Hello Chris,

    Thank you for the reply.

    Previously I had the mFi and UniFi running on a windows server 2012 but don’t know if in the Pi they can run together, at least I tried! πŸ™‚

    I have the memory split to 16mb as described in some guides.

    Since I don’t have another Pi device I can test it with only the mFi, but I would like to know first if the installation process is the same as the UniFi?
    I tried it only by changing the download link but don’t know if there is something more to change since I’m not a linux guy!

    Thanks
    Renato

  106. Hi Gaiex,

    That’s a really good question! Unfortunately I haven’t had a chance to look at mFi very much, and I don’t have any mFi hardware (yet), but from what I’ve read it is a very similar software configuration to UniFi (uses Java/MongoDB, etc). I might see if I can do up an installation article for it!

    From what you are saying, you are running UniFi and mFi on the same Pi? Nice! I guess the first thing I would try is to run mFi on a separate Pi (if you have a spare) to see if you get the same behaviour. It may not be something Ubiquiti have even considered.

    The only other thing I can think of is if you have lowered the “Memory Split” option in raspi-config?

    Kind Regards,
    Chris.

  107. Thank you for the info,

    Have the UniFi running great on my raspberry pi 2.

    Can I ask if the install process for the mFi is the same, except the download links?
    I installed it and it runs but after some time it freezes and close SSH connections to the raspberry pi 2 and I cannot connect to it! even with and mouse and keyboard and monitor the system looks like it’s frozen, but after an restart I enter in the UniFi software and I can see that it was loging all the time!

    Do you know what could be the problem?

    Thanks for any help.

  108. I finally got around to moving my controller to a Pi2 after months of procrastinating (the manual methods featured in other tuts didn’t seem ‘reliable’ to me)

    Spent 10 minutes trying to pin just the unifi-related and mongodb from jessie so I still had a reasonably ‘sane’ install. Gave up with the pinning, installed everything it wanted/needed from jessie and removed the jessie source.list.d. hopefully APT doesn’t complain too much next with I do an upgrade.

    Now to hack up the keystore to get my valid TLS cert on it so chrome stops nagging πŸ™‚

    Thanks!

  109. Hi Ben,
    Short answer – Yes.
    The UniFi installer uses the jsvc daemon for launching Java applications as a background service. So once you’ve installed the UniFi Controller software, it will auto start each time you reboot your Raspberry Pi.

  110. All sorted, I had left the in, I removed it and it all worked sweet.
    Many thx

  111. Brilliant, worked like a charm on my Pi2. 45 mins from opening Pi2 box to getting Unifi controller working!

    Thanks so much

  112. Thank you very much for this. I have tried 4 other install instruction sites and every other one would restart my Pi 2 with a kernel halted error. Yours was the first and only one to work without error. Awesome tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *