Skip to content

Instantly share code, notes, and snippets.

@keilmillerjr
Last active October 21, 2020 08:20
Show Gist options
  • Select an option

  • Save keilmillerjr/eb54fbfa846f29e303a54cf6a13cbe5e to your computer and use it in GitHub Desktop.

Select an option

Save keilmillerjr/eb54fbfa846f29e303a54cf6a13cbe5e to your computer and use it in GitHub Desktop.
Create Remote UniFi SDN Controller

Create Remote UniFi SDN Controller

Create A New Linode

Directions are loose. Follow on screen directions appropriately.

  1. https://cloud.linode.com/linodes > Add a Linode
  2. Choose a Distribution > Images > Debian 10
  3. Generate an SSH Key if not present
  4. $ ssh-keygen
  5. ~ cat ~/.ssh/id_rsa.pub
  6. Copy public key results
  7. Add SSH Key from local computer
  8. Label > id_rsa
  9. SSH Public Key >
  10. Create

SSH into your Linode

The public IP Address of your linode can be found here.

# Replace IP Address with IP Address of Linode
$ ssh root@192.168.1.1

Unifi Installation Script

UniFi Installation Scripts | UniFi Easy Update Script | UniFi Let's Encrypt | Ubuntu 16.04, 18.04, 18.10, 19.04, 19.10, 20.04 and 20.10 | Debian 8, 9, 10 and 11

  1. SSH into your Linode as root.
$ apt-get update; apt-get install ca-certificates wget -y
$ rm unifi-latest.sh &> /dev/null; wget https://get.glennr.nl/unifi/install/install_latest/unifi-latest.sh && bash unifi-latest.sh

Controller Status

  1. SSH into your Linode as root.
$ sudo service unifi restart
$ sudo service unifi status
$ sudo service unifi start
$ sudo service unifi stop

Browse to Controller

The default port for UniFi is 8443. You can use a web broser and navigate to https://ip.of.your.server:8443 or https://mydomain.com:8443

Adding a Domain Name

Add Domain

  1. https://cloud.linode.com/domains > Add a Domain
  2. Select Master
  3. Domain > <yourdomain.com>
  4. SOA Email Address > youremail@mail.com
  5. Insert Default Records > Insert default records from one of my Linodes.
  6. Linode >
  7. Create

Edit Domain

  1. https://cloud.linode.com/domains > Edit DNS Records
  2. Remove instances of mail server. They are not needed for unifi.

Install Nginx

  1. SSH into your Linode as root.
$ sudo apt update
$ sudo apt install nginx

Configure Nginx

By default on Debian systems, Nginx server blocks configuration files are stored in /etc/nginx/sites-available directory, which are enabled through symbolic links to the /etc/nginx/sites-enabled/ directory.

SSH into your Linode as root and create a Nginx configuration file.

$ nano /etc/nginx/sites-available/unifi.conf
--------------------
server {
  listen 80;
  listen [::]:80;

  server_name yourdomain.com;

  location / {
      proxy_pass https://192.168.1.1:8443/;
  }
}

Create a symbolic link.

$ ln -s /etc/nginx/sites-available/unifi.conf /etc/nginx/sites-enabled/

Test the configuration.

$ sudo nginx -t

If there are no errors, the output will look like this:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Restart Nginx.

$ sudo systemctl restart nginx

You should now be able to browse to https://mydomain.com and see the UniFi SDM Controller login page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment