Installing Ubiquiti UniFi Controller in a jail

Installing Ubiquiti UniFi Controller in a jail


If you are installing on FreeNAS 11.1, it's recommended you create the jail using iocage. This will future proof the jail and can be done via the new UI by visiting http:// <your_freenas_ip> /ui, or by using the iocage command line utility. This is not covered in the video.

How-to Video

Videos have been moved from YouTube to Odysee, a blockchain video streaming service using LBRY.

Please note, these videos should be considered "legacy" as they cover FreeNAS 9.10 and 11. The instructions can be adapted for TrueNAS as the process is more or less similar. Results may vary.

  • Create a jail and enable VIMAGE (See for more details)
  • SSH to your FreeNAS box and run: jexec <jailname> csh (replace <jailname> with your jail's name)
  • Update pkgs: pkg update && pkg upgrade -y
  • Update ports: portsnap fetch extract
  • Change into /usr/ports/net-mgmt/unifi5
  • Build UniFi: make install clean BATCH=yes
  • Enable UniFi at boot time: sysrc unifi_enable=YES
  • Start UniFi: service unifi start
Note: If you get an error with the message Ports Collection support for your FreeBSD version has ended, run make command with ALLOW_UNSUPPORTED_SYSTEM=yes make install clean BATCH=yes

Once UniFi has started, you can access it by visiting https:// <jail IP> :8443/.

Notes for FreeNAS 11: If you're running FreeNAS 11, you may need to install OpenJDK and LLVM via pkg before building UniFi, as building OpenJDK and LLVM from ports will sometimes fail. Install using pkg instead:
  • pkg install bash llvm40 openjdk8.
What did I just do?

If you followed the instructions correctly, you have just installed Ubiquiti's UniFi Controller. By using ports, you have installed a known and trusted release directly from Ubiquiti. As part of the process, you also successfully installed all of the dependencies that the UniFi controller requires, such as Java, LLVM and MongoDB.

Upgrading to the latest version
  • SSH to your FreeNAS box and run: jexec <jailname> csh
  • Update ports: portsnap fetch extract
  • Change to directory /usr/ports/net-mgmt/unifi5
  • Stop UniFi: service unifi stop
  • Build and re-install: make reinstall clean
  • Start UniFi: service unifi start
First release
Last update
4.94 star(s) 16 ratings

More resources from m0nkey_

Latest updates

  1. The easy way

    It's now pretty simple to install the UniFi controller. It's four simple steps!pkg update pkg...

Latest reviews

Only thing i would say is that if you are using iocage as recommended the command to access the jail would be "iocage console <jailname>" Other than that Great post!
I got errors when I ran "make install clean" but I had success using "make deinstall install clean"
simple and works great, thanks!
Great guide, I ran into a small problem with changing MongoDB versions, and here's my notes...
When upgrading to the latest version (currently 5.9.29) you may require an upgrade of MongoDB from 3.4 -> 3.6. Before starting the upgrade make sure to set the compatibility version in the database to 3.4 (see:
Also, make sure to connect to the UniFi mongoDB (e.g. mongo --port 27117), just in case there is also a default mongo instance running.
failed the first time, tried installing the pkg packages listed and binary completed the 2nd attempt
seems like that could just be added as a step instead of being out of order
Thanks! Just note that "make reinstall clean" may no longer work (see

If you run into this problem then after stopping the unifi service (and inside the unifi5 ports directory) run the following:

- make package
- pkg install -f work/pkg/package-name

Replacing "package-name" with whatever is the correct name, e.g.) "unifi5-5.8.24.txz"
Great help!
Straightforward, well documented and explained.
Tons of people have asked for this in ubnt forums. Did not know it was this simple.
easy to understand and straightforward.