Install UniFi Controller [Ubuntu]

Hey! If you’re a UniFi user and you’re just starting out, you probably know that you need a UniFi Controller so you can manage all your network gear. There’s different ways you can do this: you can run the software on Windows for set up then close it, use the UniFi CloudKey, or host it yourself on a small Ubuntu VM. I bet you can tell that I did the last one!

If you want any statistics but don’t want to run this on a Windows machine, you can use a Cloudkey or a VM – I prefer the VM as it has more storage options and somewhat faster processing power. Remember, this is most easily done on Ubuntu machines.

If you have a FreeNAS server, you can just spin up a VM from the VMs tab. However, you can use anything really, even if you have a spare machine laying around.

Set Up a VM

If you’re using FreeNAS, just head to the VMs tab and click “Add VM”. You’ll need to fill in some basic info, such as the name, description, how many vCPUs and RAM.

Now once added, you’ll need to head to “Storage” and create a zvol for this machine.

Once you’ve created the zvol, head back to your VMs tab and select the new VM you created then click “Devices”. You’ll need to make sure you add this disk to the VM before booting it up. Lastly, go ahead and attach an ISO to the VM. You can simply store the ISO on the FreeNAS server in a dataset or a shared folder that can be accessed by other machines.

Note that you don’t have to be running a FreeNAS box to do this, so if you’re using something else, simply create an Ubuntu VM or rent a VPS.

Install & Configure Ubuntu
Once you’ve got the machine running, you can VNC into the VM. If all goes well, you’ll see the boot menu for the Ubuntu Server installer.

For the server hostname, you can use unifi-controller or whatever you like. You’ll also be creating a non-root user for administration. When installing the server, make sure you select OpenSSH Server on the packages page during install. Once the OS is installed, you’ll need to set the IP address of the server. In the VNC console, edit your networking config with nano /etc/network/interfaces You can use the following as a guide:

# The primary network interface
auto enp0s3
iface enp0s3 inet static
address # static IP & must be in same range as your subnet
gateway # If your subnet is 192.168.x.x, change it here
subnet # Subnet of your network
dns-nameservers # Any nameservers will do, even and

Once you’ve got a static IP set up and you can SSH into the server, go ahead and update it with apt update && apt upgrade -y

Install UniFi Controller
Once updated, run the following to add the UniFi source list:

echo 'deb stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list

and import the gpg keys with

sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg

Once you’ve done that, simply update your repos and install the unifi package.

sudo apt update && sudo apt install unifi

Remember that if you’re running an older version of Ubuntu, you may need to use apt-get instead of apt.

If you get any errors while unpacking or installing unifi, it could be that your system didn’t automatically resolve the dependencies for the package. Simply run the following to fix this.

sudo apt install -f

If all goes well, you should be able to access your new UniFi Controller at the IP address of the VM. Ex: