ubiquiti-unifi.md (3703B)
1 Setting up a Ubiquiti Network 2 ----------------------------- 3 4 Created 2019-03-28 5 6 This may sound crazy, but believe it or not, I am an IT professional. But my home network doesn't really show that. I have a Dlink can router/ap running dd-wrt. DNS is managed by a pi-hole (That is also my dhcp server) but otherwise, I have crappy wifi, and a router that overheats and bogs down my connection. 7 8 Well not anymore. I purchased a Ubiquiti EdgeRouter-X and Unifi acces point. Finally, I'll have some semi-professional gear. I've used Ubiquiti in the past and I must say it's very nice, and fairly easy to set up, espeically if you spring for the Cloud Key. In my home use case, I didn't really want to, so I wanted to try running it on my pi-hole, which just sits around doing nothing most of the day (and will still do nothing MOST of the day). 9 10 # The EdgeRouter 11 12 This is probably easiest part of the whole thing. For such a simple deployment as my home, there's not much configuration to do. Drop all packets coming in, allow all going out. Use the pihole as a DNS and DHCP server. Not much to it. If you were looking for a more in-depth walkthrough of how to do this, I'm sorry but it probably wouldn't be as useful as [Ubiquiti's Beginners Guide](https://help.ubnt.com/hc/en-us/articles/115002531728-EdgeRouter-Beginners-Guide-to-EdgeRouter). 13 14 # Installing Unifi on a Raspberry Pi 3 15 16 ## Setting it up 17 18 Should be easy, right? Just follow the instructions for Debian, right? Well... Yeah, the first thing you need to do is install UniFi. I just grabbed the deb from Ubiquiti, because I don't much care for adding PPAs, &c. The install was fairly easy, `dpkg -i unifi.deb`, but that's where the trouble began. 19 20 The service just would not start. And there were no error messages printed to the console. What to do? 21 22 From [this post](https://loganmarchione.com/2016/11/ubiquiti-unifi-controller-setup-raspberry-pi-3/) I got the following: 23 24 # apt install oracle-java8-jdk -y 25 # update-alternatives --config java 26 27 Whether this helped or not in the end, I can't say. I continued using Oracle's Java instead of OpenJava, but I don't think it would matter. 28 29 As of right now, I absolutely cannot get the service to work properly. I have tried editing `/usr/lib/unifi/bin/unifi.init` and setting the `JVM_MAX_HEAP_SIZE` and `JVM_INIT_HEAP_SIZE` variables, I have tried setting `unifi.xms` in system.properties (By the way, I don't know if I believe that doing anything in that file has any effect if it doesn't already exist), and nothing. 30 31 BUT there is a light at the end of the tunnel. If I create the jvm myself, Iit will run. I can do the following: 32 33 java -Xmx512M -jar /usr/lib/unifi/lib/ace.jar start 34 35 The controller starts, and all is well! Not sure why I can't just make the unifi service create a usable jvm~~, but I'll try opening a ticket with ubnt tomorrow~~. 36 37 Extra thanks to osunifi at the community.ubnt.com forums. It was their comment about Java using too much memory that lead me to that command to start the JVM manually. 38 https://community.ubnt.com/t5/UniFi-Wireless/NOTICE-UniFi-Controller-Memory-Usage-5-6-20/m-p/2268804/highlight/true#M282524 39 40 # Final Thoughts 41 42 I'd say don't do this... Even with my workaround above, the JVM crashes after a few hours (Maybe less? I actually don't check it frequently) so I'm currently living without a cloudkey. That's fine, since nothing changes in my environment, but I have no monitoring or insight into my WiFi. 43 44 If you want a UniFi setup in your home, I'd say just buy the damn cloudkey or put it on a server with a minimum of 2GB of RAM. 45 46 ubiquiti-unifi.md | Last Edited 2019-04-25 | Cleaned up some of the sections and added final thoughts.