run your UniFi Controller in the cloud

Dan Reid
Dan Reid
Aug 18, 2017 · 5 min read

Why do this? Whether this is for home or business, it can be a drag to find a place to run the controller if you don’t have on-prem servers. A cloud based controller can also be a huge benefit if you have multiple sites, as you can then manage your entire multi-site network from a single pane.

I’m writing up this guide to help consolidate the various information I had to use to get my UniFi controller working properly for L3 adoption. It’s not really complicated, but judging by forum posts on the UBNT support site a lot of people are having the same problems over and over. Perhaps this will help someone out.

Getting Started —

You’ll need to spin up a VM in whatever cloud provider you like. Make sure your instance meet the recommended requirements on the UBNT support page.

In my case I’m using Vultr.com, and Ubuntu 16.04 x64, but you can use AWS, DigitalOcean, etc.

I’m going to skip the details around provisioning your cloud based VM, as you should be familiar with this and if you aren’t I would recommend getting familiar before you start this project. Settings can vary wildly between cloud providers. Before the next step you’ll need a functioning VM that you can SSH into.

Installation prep —

Firewall —
You will need the following Inbound IPv4 rules setup in your firewall:

3478/UDP
22/TCP
8080/TCP
8443/TCP
8843/TCP
8880/TCP

You can leave these open to 0.0.0.0/0 or lock them down as needed based on your LAN/WAN config. Just make sure your UniFi devices can talk to the public IP of your UniFi controller over these ports.

Java & MongoDB —
These two items tend to be the ones overlooked by most articles and the two items that will cause you the most grief if done incorrectly. I spent way too much time on forums reading and going through install/uninstall cycles.

Install Oracle JDK 8
What we’re doing here is adding a new repository and then installing the ‘official’ Oracle Java 8 SDK — this will work with Unifi out the box without having change config settings.

sudo add-apt-repository ppa:webupd8team/javasudo apt-get updatesudo apt-get install oracle-java8-installer

Install MongoDB
Here we add the repo for Mongo and perform a pretty vanilla installation of MongoDB and add it to startup. You need this as Ubuntu will NOT install it as part of the dependencies for the UniFi package. UniFi will act like it’s starting, but never actually start if MongoDB is missing.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.listsudo apt-get updatesudo apt-get install mongodb-orgsudo systemctl start mongodsudo systemctl status mongodsudo systemctl enable mongod

Install UniFi Controller
Now for what we’re all here for — installing the UniFi controller.

First, you need to add the appropriate repository. We do this by creating a new repo file:

sudo nano -w /etc/apt/sources.list.d/100-ubnt.list

Paste the following into that file and save.

## Debian/Ubuntu
# deb http://www.ubnt.com/downloads/unifi/debian testing ubiquiti
# deb http://www.ubnt.com/downloads/unifi/debian oldstable ubiquiti

deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti

# The following is a mapping of suite name->code name.
# stable->unifi-5.4
# testing->unifi-5.5
# oldstable->unifi-5.3

Next, add the repo GPG key

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50

Install UniFi!

sudo apt-get update
sudo apt-get install unifi

If you did all this correctly, you should be able to log into your UniFi controller and start the install wizard.

https://<ip of your cloud instance>:8443

After this step I’m assuming you know something about UniFi so I am not going to get into the specifics of a controller setup. There is plenty of info out there already about this topic.

L3 adoption/management —

If you are doing this with brand new gear, it’s very easy. If you’re doing it with a device it’s still pretty easy, just follow the steps as outlined. I tried various methods others had posted online to move my devices from a local controller to a cloud based controller and I spent way more time than reasonable and eventually just gave up as it was quicker to just reset it all and re-configure.

Pay attention to step 8. Don’t ask me why.

Your inform URL will be - http://<ip of your cloud instance>:8080/inform

To perform L3 adoption with the discovery utility:

  1. If your devices are new out of the box, skip to step 3.
  2. If your devices are already managed by a controller you want to log into your current controller and ‘forget’ them. This will erase all configuration and history for that device.
  3. Open your discovery tool of choice (I recommend the Chrome browser extension) and you should see your devices in a pending state.
  4. If the device is not in default state. click “reset”, specify the SSH username/password and click “Apply”
  5. Click on “manage”, modify the inform URL and leave the SSH username/password as ubnt/ubnt and click “Apply”
  6. Open a browser to your remote UniFi controller and you should see it being “Pending Approval”
  7. Click on “adopt”. You’ll see it going to “Adopting” state, ignore it as it’ll eventually become “Adoption Failed” or “Disconnected”
  8. perform [step 3] again (no need to wait for [step 5] to finish)
  9. AP is now managed by the controller

Note: If you get login errors when trying do the L3 adoption steps, I suggest you go do a physical reset. I had some issues where it wouldn’t accept my user/pass for devices once they were ‘forgotten’.

That should be it!

References:

Thanks to the following for various bits of info I used to help compile this write-up.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade