I am leaving this here for the reference and posterity, but for a variety of reasons, I no longer recommend doing this. It is a neat hack, but tends to be a bit of a pain to live with as you end up having to troubleshoot or reinstall it every time you update pfSense or Unifi. When you can install it on a Raspberry Pi for less than $50, there's really no need to do this.
I personally have switched to running this on a stock Ubuntu system that runs a few other network services in my house.
This is a short tutorial on how to install the Ubiquiti Networks’ UniFi Enterprise Wifi controller software on pfSense 2.2. These directions are derived from these directions for 2.1-RC, but have been updated to work on 2.2.
Note that this is a somewhat advanced tutorial. If you are not comfortable working in a Unix command line or editing system files, this is probably not the best thing you could do. But I’m putting it out here in case it will help others.
Initial Setup
- Optional: If you already have the UniFi software installed on another computer, you will need to dump a backup. Log in and go to Admin (at the bottom) and click “Download Backup Settings.” Then shut down that instance of the software.
- Enable Shell Access. Go to System -> Advanced, under “Secure Shell,” select “Enable Secure Shell.”
- SSH to your pfSense machine and enter shell. As of this writing, that’s option 8 once you’ve connected and logged in.
- Optional: Make a complete backup. Type
/etc/rc.create_full_backup
and let it run. cp /etc/skel/dot.tcshrc /root/.tcshrc
source ~/.tcshrc
Install Prerequisites
- Type
pkg
. This will ask you if you want to install pkg. Type “Y” and wait. pkg install unzip
pkg install wget
pkg install mongodb
pkg install openjdk
rehash
Setup Prerequisites
mount -t fdescfs fdesc /dev/fd
- Edit your /etc/fstab as instructed by the message generated by the OpenJDK installation.
Here, I rebooted pfSense. Not strictly necessary, but I wanted to be sure that everything I had done up to this point (such as editing the fstab file) had not made the system unbootable.
Install the UniFi Software
- From the UniFi update blog, find the most recent update (as of this time, it’s 3.2.10). Scroll down until you find “UniFi.unix.zip.” Copy the link.
- On your pfSense box:
cd ~
wget http://www.ubnt.com/downloads/unifi/3.2.10/UniFi.unix.zip
(or whatever the URL you have is).unzip UniFi.unix.zip
mv UniFi /usr/local/
cd /usr/local/UniFi/bin
ln -s /usr/local/bin/mongod mongod
/usr/local/etc/rc.d/mongod onestart
cd /usr/local/UniFi/lib
java -jar ace.jar start &
Now wait 3-5 minutes. When it comes up, it will come up on port 8443. You can check to see if it’s up or not by running netstat -an | grep 8443
. For some unknown reason, their controller software is just very slow to come up on Unix.
Eventually, when it does, you can use “https://<your ip here>:8443” to reach it. Note the HTTPS. It won’t redirect you to secure and will just send garbage. You have to directly use https.
Optional: If you downloaded a backup as above, you can restore it now. Instead of setting up a new controller, use the link at the bottom of the window that says “Restore a backup” or something similar. If you do this, after it finishes restoring, you will need to manually relaunch the controller.
java -jar ace.jar start &
Final Setup
This final step insures the UniFi controller software restarts if you reboot pfSense.
- Install the “shellcmd” package. Go to System -> Packages, Available Packages. Find “Shellcmd” and install it.
- Go to Services -> Shellcmd.
- Add a new shell command. The command is
/usr/local/openjdk7/bin/java -jar /usr/local/UniFi/lib/ace.jar start &
and the type isshellcmd
. - Press save.
That’s it! You now have a working UniFi controller installation on your pfSense machine!
A Note About pfSense Ugrades
Incremental upgrades to pfSense haven’t seemed to affect this at all. However, major point upgrades (2.1 to 2.2 for instance) will often remove some of all of this. When I upgraded to 2.2, it didn’t work at first, but it turned out that I just needed to reinstall OpenJDK. So it is probably best, before doing an upgrade, to dump a backup of your UniFi settings in case you need to reinstall.
Upgrading UniFi
To upgrade UniFi, make a backup from the existing UniFi installation (step 1 at the top) and start over under “Install the UniFi Software” above. Then restore your settings, restart the controller software, and apply the updates to your access points.