Installing the UniFi Controller on FreeNAS
This artical will guide you through installing the Unifi Controller within a new FreeBSD jail, on a FreeNAS 9.3-STABLE server. You are required to have root access to the FreeNAS server for this install.
Creating and Setting up the FreeNAS Jail
Create a new jail
Create a new jail on your FreeNAS system, default options are fine. You may set a static address or use DHCP.
Set the Jails Root Password (Optional)
To set the root password, run passwd
and enter your new root password.
Enable the SSH Server (Optional)
Modify the /etc/rc.conf
file and change sshd_enable="NO"
to sshd_enable="YES"
sed -i .bkp 's/sshd_enable=\"NO\"/sshd_enable=\"YES\"/g' /etc/rc.conf
Then enable root access via SSH.
sed -i .bkp 's/#PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config
And lastly start/restart the sshd daemon.
service sshd start
Installing UniFi Controller v5
From, inside your new jail, via a ssh session or shell prompt as root run...
Update the FreeBSD packet file
freebsd-update fetch
Install Java8JDK
Install Java openjdk8 on the jail.
pkg install -y openjdk8
Configure openjdk8 to work within the jail.
echo "fdesc /dev/fd fdescfs rw 0 0" > /etc/fstab echo "proc /proc procfs rw 0 0" >> /etc/fstab
Install MongoDB
Install mongodb on the jail.
pkg install -y mongodb
Then set mongodb to load on system boot.
echo 'mongod_enable="YES"' >> /etc/rc.conf
Install Unifi Controller
Finally let's install the actual controller software.
setenv BATCH yes portsnap fetch extract cd /usr/ports/net-mgmt/unifi5/ make install clean
Once the build is complete, you may start the controller.
echo 'unifi_enable="YES"' >> /etc/rc.conf service unifi start
Setting up the UniFi Controller
First go to the IP address of your Unifi host, ie: https://<IP-Address>:8443
You will be prompted to accept an Invalid SSL Certificate before accessing the new site.
Configuring the UniFi Controller
The config may be found at /usr/local/share/java/unifi/
Updating UniFi Controller
To update UniFi to the current stable version, first check to see if a new version has been published in FreeBSD ports by viewing the UniFi5 ports Makefile file. Check if the version is the newer then the version you are currently running.
Assuming you need an update, run the following command on your FreeNAS Jail.
portsnap fetch update && cd /usr/ports/net-mgmt/unifi5/ && make deinstall reinstall clean && \ service unifi restart