Technology, Linux, Networking

Ubiquiti UniFi Controller

Like most folks, I started out with just a wireless router… I picked a D-link and it lasted me many moons.  Then, I bought my first house and that one device just couldn’t give me the coverage I needed.  So I added in a couple of D-link wireless access points.  Whenever I would jump between them on my phone or laptop the brief interruption would annoy me, but I just dealt with it.  Over the years my ISP kept upping speeds, and eventually they surpassed what my old D-link could keep up with.  I ended up replacing it with a Linksys E4200 and flashing DD-WRT onto it.  At the same time, I decided I was tired of the wireless issues and was going to fix it, and started looking around.  That’s when I settled on Ubiquiti, they’re pretty good bang for the buck, you get some enterprise features at a consumer price.  One being true mesh with the ability to properly hand off a device between APs, and another being a management console, which is the focus of this post.

When I first got the UniFi UAPs, I installed the controller on a Windows 10 PC.  It’s kind of a pain as it runs on Java/Tomcat, doesn’t have a true installer, and is a little bit interesting to get setup to run reliably as a service.  Some time later, I installed VMWare ESXi on some hardware I had laying around and spun up a CentOS 6 VM to do some testing with.  After it’s original purpose had been served, I decided to keep it around and install the UniFi controller software onto it.  That’s when I discovered that Ubiquiti only has official packages for Debian/Ubuntu.  A quick Google later and I had this guide.  I followed it, and was able to get the controller up and running, but it really seemed like far too much work for something so relatively simple.  For the most part it all worked fine, but occasionally the service would just die and need to be started again.  This doesn’t affect the operation of the APs at all, once they’re configured they will run independent of the controller, it’s only if you want to login to the console that you’ll realize it has crapped out.

Now I needed to get it installed in a CentOS 7 container… I thought to myself, there must be a better way.  Another quick googling came up with some unofficial packages put together by members of the Ubiquiti community forums.  While they are “unofficial” they did get the blessing of Ubiquiti as seen here.  You can find the instructions for utilizing them here.  The only prerequisite is to enable the EPEL repository to be able to get the mongodb package.

Once the install is complete and you have started the services you can then point your browser to https://yourserver:8443, however it annoys me having to enter in the port number and remembering that it’s https.  This is running on an embedded instance of tomcat under a user other than root, so while you can modify it to redirect port 80, it’s not quite so simple.  I decided just to install nginx with a minimal config to redirect port 80 to 8443 instead.

Add the redirect to the config, this is the relevant server block:

Then just enable nginx and start it:

You should now be able to hit http://yourserver and it will automagically redirect you to https://yourserver:8443.

The final step was just to export my configuration from the previous server and import onto the new, this is very easy from within the web console.  Just navigate to settings > maintenance and download a backup.  Then go to the same spot on the new controller and restore the backup you just downloaded.

UniFi Controller Backup

It’s as simple as that, all my APs moved over to the new controller within a couple of minutes and I was able to shutdown the old server.

 

 

Series Navigation<< Install Plex on CentOSCentreon Monitoring >>

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.