# Installing the Unifi Controller on FreeNAS

There are a couple of guides (1, 2) for installing the Unifi Controller on FreeNAS, but they all include a build step that always failed for me. I finally got the controller running after I saw a comment on the Ubiquiti community forums that mentioned installing from FreeBSD Ports.

I did this on FreeNAS version 11.2-U7, but these steps are general enough that it should work with any version.

# Create a New Jail

Firstly, create a new jail using the FreeNAS interface by going to the Jails tab:

# 1. Name Jail and Choose FreeBSD Release

  • Enter a name for the jail; I went with unifi. This will also be the hostname used to access the controller later.
  • Choose a FreeBSD release; I picked the latest release at time of writing - 11.3.

# 2. Configure Networking

  • Tick boxes for:
    • DHCP Autoconfigure IPv4
    • VNET
    • Autoconfigure IPv6

And hit next.

# 3. Confirm Options

  • Confirm the settings for the jail and submit.

# Install the Unifi Controller

Now the jail has been created, we shell into the jail to install the controller from Ports.

On the Jails screen int he FreeNAS web UI, find the new unifi jail and click the 3 dots to the right, then click Start. Once the jail has started, go back to the dropdown menu again and click Shell to get an interactive shell.

Update the package listings and upgrade any installed packages:

pkg update && pkg upgrade -y

If you get the following message, answer y to install the package manager:

The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y

Install the unifi5 package and its dependencies:

pkg install -y unifi5

Enable the Unifi service by running:

sysrc unifi_enable=YES

Then, start the Unifi service:

service unifi start

Pro Tip: Copy and paste the following to run all the above in one easy step:

pkg update && pkg upgrade -y && pkg install -y unifi5 && sysrc unifi_enable=YES && service unifi start

# Setup the Controller

The Unifi controller should now be accessible at https://[IP of Jail]:8443. You can get the IP of the jail from the Jails screen in the FreeNAS UI. Alternatively, you can try going to https://unifi:8443.

The controller uses a self-signed certificate, so accept any browser warnings and add the certificate to your trusted certificates if prompted.