Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.
Installing Ubiquiti UniFi Controller in a jail

Installing Ubiquiti UniFi Controller in a jail

IMPORTANT UPDATE!

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

Installing
  • Create a jail and enable VIMAGE (See http://doc.freenas.org/11/jails.html#adding-jails 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
Author
m0nkey_
First release
Last update
Rating
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

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: https://docs.mongodb.com/manual/release-notes/3.6-upgrade-standalone/).
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 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224244)

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"
Easy to follow along and most importantly, it worked!
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.
Top