How to install Ubiquiti UniFi controller on the cloud

Recently I replaced my wireless router, an Asus RT-AC66U, with an Ubiquiti EdgeRouter X router and Ubiquiti UAP-AC-LR access point. Both of which are a HUGE step up over traditional consumer wireless routers.

The Ubiquiti access points use software called the Ubiquiti UniFi controller to configure and control the access points which can be installed locally or in the cloud – allowing you to manage the access points no matter where they are located.

To automate the install process, I created a simple script to deploy the Ubiquiti UniFi Controller in the cloud on a Ubuntu server, and have also tested the script on three popular VPS providers: Linode, Vultr, and DigitalOcean – all three worked perfectly!

Linode would be my first choice as they offer the best performance and with 1CPU and 2GB RAM you’ll have more than plenty of resources to run Ubiquiti UniFi Controller and manage many sites and access points.

If you have a small deployment, Vultr would easily be my choice with 1CPU and 768MB RAM! All three providers also cost less than AWS and Azure.

For my deployment I went with Linode as I plan on using it to control not only my home access points but to control the access points of customers and family as well.

Lets begin…

Create a cloud server for the UniFi Controller

  1. First step is to create your Linode node and to do so simply select your node size and location and click on “Add this Linode!“.
    Create Linode node
  2. Next click on “Dashboard“.
    Linode node dashboard
  3. We need to deploy an operating system on our new node so click on “Deploy an Image“.
    Deploy image on Linode node.
  4. For image type select “Ubuntu 16.04 LTS” and set your root password then click on “Deploy“.
    Deploy Ubuntu image on node.
  5. Wait until the three Host Job Queues are complete (initial config, disk create, and file system create) and then click on “Boot“.
    Boot Ubuntu node

Your new node is now built and ready to have the Ubiquiti UniFi controller installed onto it.

Install Ubiquiti UniFi Controller on Ubuntu

While the Ubiquiti UniFi controller install process is pretty easy, I’ve tried to make the process even easier by scripting it. It’s now as simple as running one single command.

The script is hosted on GitHub (unifi-autoinstall) and I strongly urge everyone to view the source and inspect it before running it as it’s never good practice to blindly run scripts. So with that lets get started…

  1. SSH into your new Linode node using PuTTy or Terminal and type the following command and press Enter to download the script to your server.
    wget https://raw.githubusercontent.com/miketabor/unifi-autoinstall/master/install.sh

    wget unifi-autoinstall script from GitHub

  2. Next lets view the script to see what it does by typing the following:
    less install.sh

    less install.sh unifi script

  3. You can now view the contents of the UniFi autoinstall script, install.sh. Once you’ve viewed it you can press q to exit and continue on.
    Less output of Unifi install.sh
  4. Now lets actually run the script. Type the following to start the script to auto configure the firewall, Fail2ban and install the Ubiquiti UniFi Controller.
    sudo bash install.sh

    sudo bash install unifi script

  5. When the script finishes, typically less than 1 minute, you’ll see a message letting you know it’s finished and to log into your new UniFi controller by going to: https://<SERVER_IP>:8443
    UniFi-autoinstall install completed.

That’s it! The Ubiquiti UniFi Controller is now ready to for use. Now go ahead and go to https://<SERVER_IP>:8443 and finish the UniFi Controller wizard. Finally, beefore we move on to far I wanted to quickly explain what exactly the script is doing.

  • First it updates all the packages on Ubuntu.
  • Configures UFW to allow only SSH and the needed Ubiquiti UniFi ports (per ubiquiti documentation)
  • Installs latest version 5 UniFi controller and its dependencies.
  • Finally installs Fail2Ban and configures it to protect SSH (default) as well as the UniFi login page!

Now lets discover and register the new access points to the UniFi controller.

How to register access points to UniFi controller in the cloud

The last step is to register the access point(s) with the UniFi Controller on the cloud, in this case Linode.

  1. Open the Ubiquiti Discovery Tool or use the Ubiquiti Chrome extension.
  2. Typically right away the discovery tool will find all the access points on your local network. Next to the one you want to register with the UniFi controller click on “Action“.
    Ubiquiti discovery tool.
  3. In the Actions drop down set to “Set Inform” and change the Inform URL to: https://<UniFi_Server_IP–OR–FQDN>:8080/inform
    Inform UniFi of access point.
  4. Now go to your UniFi Controller and the Ubiquiti access point should be listed and awaiting your action. Click on Adopt.
    Adopt access point on UniFi controller

That’s it! That completes setting up a Ubiquiti UniFi controller in the cloud and registering your access point with the new UniFi controller. The only steps left would be to setup your SSID, policies, additional sites, and so on.

Hope this helps and enjoy!

  • bob_henderson

    Did you really just suggest I randomly curl straight into bash from a shortened URL?

    I mean, I looked at the script, it was fine. But come on bud. Don’t do that.

    • bob, I angered the bash gods for sure and have corrected my mistake. Please refresh the page and the CORRECT way of loading this script has been added. 🙂

      Thanks for the comment!

      -Michael

  • Gabriel

    Thanks for your time and information. Another option for Synology owner is to use it for run locally the Unify, http://synology.acmenet.ru/.

    Best Regards,

    • Thanks Gabriel! i’m actually working on a post on how to run the UniFi on Docker within a Synology NAS as well.

  • rebelbah

    i followed your guide from “Install Ubiquiti UniFi Controller on Ubuntu” , as i used cloudatcost services and unifi 5.2.9 is running and it sees the UAP when i click adopt it shows adopting for a few minutes then shows disconnected, the UAP is connected to an edgerouter x inside of my ISP router , is there ports i need to open

    • @rebelbah:disqus you said you are using an EdgeRouterX behind your ISP router? Do you mean your ISP modem or do you really have a router behind a router?

      You could also try manually setting the adopt IP via SSH on the access point as shown under SSH on this page: https://help.ubnt.com/hc/en-us/articles/204909754-UniFi-Layer-3-methods-for-UAP-adoption-and-management

      • rebelbah

        Yes it’s a edge router behind my ISP router, I got it working, was not issuing the inform command the second time after I was selecting adopt, thanks for your help

  • Nicolas Frenet

    hello, thanks for this script but can we also run it on aws ?