Reply
New Member
Posts: 21
Registered: ‎08-15-2013
Kudos: 4
Solutions: 1
Accepted Solution

Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

[ Edited ]

Since we got a problem with Login and password with version for Unix 3* because mongodb is 1.4.8, I decide to make this quick tutorial based on : http://community.ubnt.com/t5/UniFi/Tutorial-Experiment-UniFi-running-on-pfSense/td-p/186361

Tutorial/Experiment: UniFi running on pfSense

1. Install PfSense. - pfSence 2.1 RC
2. Enable Secure Shell (SSH) in pfSense
3. Prep work, and Install MongoDB

cp /etc/skel/dot.tcshrc /root/.tcshrc
source ~/.tcshrc

pkg_add -rv unzip
pkg_add -rv wget
pkg_add -rv mongodb
pkg_add -rv openjdk7

mount -t fdescfs fdesc /dev/fd
rehash

Download via wget or NC Unifi.unix-3.1.4.zip

unzip Unifi.unix-3.1.4.zip
mv UniFi /usr/local/
cd /usr/local/UniFi/bin
rm mongod
ln -s /usr/local/bin/mongod mongod
/usr/local/etc/rc.d/mongod onestart
cd /usr/local/UniFi/lib
java -jar ace.jar start &

If everything is O.K in a 3-5 minutes you will get port 8443
netstat -an | grep 8443

Enjoy.


Accepted Solutions
New Member
Posts: 21
Registered: ‎08-15-2013
Kudos: 4
Solutions: 1

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

[ Edited ]

You can run these version of UniFi Unix:

pfSence 2.0.3 Release + mongodb 1.4.8 + openjdk6

- UniFi.unix-2.2.5

- UniFi.unix-2.3.8

- UniFi.unix-2.3.9

- UniFi.unix-2.4.4

pfSence 2.1-RC + mongodb 2.0.4 + openjdk7

- All above +

- UniFi.unix-3.1.1

- UniFi.unix-3.1.3

- UniFi.unix-3.1.4

All are tested and they are working PERFECT.

Hope i can help people to make it right in notime. If there is any questions reply to this thread

View solution in original post


All Replies
New Member
Posts: 30
Registered: ‎06-26-2013
Kudos: 1

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

Thanks!

Too bad I can't run 3.1.4 since it ruins my connection speed (http://community.ubnt.com/t5/Installation-Troubleshooting/Slow-WiFi-connection-when-using-multiple-S... Just ordered a UAP AC so I hope UBNT will get it to work since I have to run 3.1.3+ for AC.

New Member
Posts: 19
Registered: ‎08-13-2013
Kudos: 5

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

Thank you, this is exactly what I was looking for.

Established Member
Posts: 1,185
Registered: ‎04-07-2013
Kudos: 548
Solutions: 47

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

I would recommend installing pfjailctl and installing unifi and the dependencies (mongodb and openjdk) in a BSD Jail. This will keep the underlying pfsense installation relatively vanilla while providing a virtual environment to run unifi. This also is inherently a layer of security... A java vulnerability could otherwise compromise the entire box.

Great write up though Man Happy
When you receive a solution to your question/issue, don't forget to mark your thread as solved and to give kudo's to the people who have helped you out!
New Member
Posts: 21
Registered: ‎08-15-2013
Kudos: 4
Solutions: 1

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

[ Edited ]

You can run these version of UniFi Unix:

pfSence 2.0.3 Release + mongodb 1.4.8 + openjdk6

- UniFi.unix-2.2.5

- UniFi.unix-2.3.8

- UniFi.unix-2.3.9

- UniFi.unix-2.4.4

pfSence 2.1-RC + mongodb 2.0.4 + openjdk7

- All above +

- UniFi.unix-3.1.1

- UniFi.unix-3.1.3

- UniFi.unix-3.1.4

All are tested and they are working PERFECT.

Hope i can help people to make it right in notime. If there is any questions reply to this thread

New Member
Posts: 22
Registered: ‎11-15-2013
Kudos: 3
Solutions: 3

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

[ Edited ]

@rcmcdonald91

Nice idea. Then expand this tutorial with this how-to, please.

New Member
Posts: 22
Registered: ‎11-15-2013
Kudos: 3
Solutions: 3

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

[ Edited ]

Nice work. But how would you have this starting on boot time?

I tried with this

#!/bin/sh
/usr/local/etc/rc.d/mongod onestart
/usr/local/openjdk7/bin/java -jar /usr/local/UniFi/lib/ace.jar start &

 at 

/usr/local/etc/rc.d/unifi_control.sh

 Unfortunately after that I have two java processes. Where do I go wrong?

I don’t know what happend before. But after another reboot of my pfSense it works like a charm.

 

New Member
Posts: 21
Registered: ‎08-15-2013
Kudos: 4
Solutions: 1

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

[ Edited ]

There is a mistake in the SH script.

Unifi controller brings up mongodb automatic. So disable the line with monod onestart

If this not works. use this

#!/bin/sh
cd /usr/local/UniFi/lib
# on execute java
java -jar ace.jar start &

 

#!/bin/sh
/usr/local/openjdk7/bin/java -jar /usr/local/UniFi/lib/ace.jar start &
New Member
Posts: 22
Registered: ‎11-15-2013
Kudos: 3
Solutions: 3

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

I don’t know why but with this modification it doesn’t run. But again it starts 2 java processes

[2.1-RELEASE][root@pfsense.quidproquo.ch]/usr/local/UniFi/lib(11): ps aux | grep java
root       55987  0.0  2.6 373004 26300  ??  SN    3:34PM   0:00.52 /usr/local/openjdk7/bin/java -jar ace.jar start
root       30796  0.0  2.4 375060 24824  v0- R     3:34PM   0:00.55 /usr/local/openjdk7/bin/java -jar ace.jar start
root       44309  0.0  0.1  1792  1064   0  R+    3:37PM   0:00.00 grep java

 

New Member
Posts: 32
Registered: ‎01-05-2013
Kudos: 35

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

[ Edited ]

I have a FreeBSD port written for unifi that I use personally. If they made it possible to automatically fetch the .zip without requiring you to agree to their terms I'd commit it to the ports tree.

edit: looks like they changed their mirror system. I'll be committing net-mgmt/unifi to the ports tree soon.

New Member
Posts: 32
Registered: ‎01-05-2013
Kudos: 35

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

net-mgmt/unifi is now committed to freebsd ports. You should be able to easily get it running on pfSense now.

New Member
Posts: 22
Registered: ‎11-15-2013
Kudos: 3
Solutions: 3

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

Sorry for this silly question. But how can I install this? I have the controller running by installing by hand. Should I change to this package like installation?

New Member
Posts: 21
Registered: ‎08-15-2013
Kudos: 4
Solutions: 1

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

Required To Run:

  1. databases/mongodb
  2. java/openjdk7

To install the port: cd /usr/ports/net-mgmt/unifi/ && make install clean

 

New Member
Posts: 22
Registered: ‎11-15-2013
Kudos: 3
Solutions: 3

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

I don’t have any ports directory at /usr

If I try to install the package, I get an error 

[2.1-RELEASE][root@pfsense.quidproquo.ch]/(9): pkg_add -rv unifi
looking up ftp.freebsd.org
connecting to ftp.freebsd.org:21
setting passive mode
opening data connection
initiating transfer
Error: Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.3-release/Latest/unifi.tbz: File unavailable (e.g., file not found, no access)
pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.3-release/Latest/unifi.tbz' by URL
pkg_add: 1 package addition(s) failed

 so I need the correct URL to download it. 

New Member
Posts: 3
Registered: ‎12-06-2013

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

Can someone please do me a favor?

I have PFSense 2.1 running on a Supermicro PC that is mounted downstairs in the rack.  I have ordered, and want to add a Unifi wireless AP to the project.  

Currently I use a Linksys WRSV4400N for wireless, but it sucks...bad.  The Unifi will need to be connected to my 48 port Dell network switch, as the two ports on the Supermicro as used for LAN/WAN.

I've got EXTREMELY limited experience with shell and command line prompts.  I follow directions well, and pick up on things quickly.  Can someone give me a detailed rundown on what I need to do in order to get this Unifi integrated and working properly with PFSense?

I would really appreciate it.

New Member
Posts: 21
Registered: ‎08-15-2013
Kudos: 4
Solutions: 1

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

[2.1-RELEASE][root@yourhost.com]/root(1): cp /etc/skel/dot.tcshrc /root/.tcshrc
[2.1-RELEASE][root@yourhost.com]/root(1): source ~/.tcshrc
[2.1-RELEASE][root@yourhost.com]/root(1): pkg_add -rv unzip
[2.1-RELEASE][root@yourhost.com]/root(1): pkg_add -rv wget
[2.1-RELEASE][root@yourhost.com]/root(1): pkg_add -rv mongodb
[2.1-RELEASE][root@yourhost.com]/root(1): pkg_add -rv opendjk7
[2.1-RELEASE][root@yourhost.com]/root(1): mount -t fdescfs fdesc /dev/fd
[2.1-RELEASE][root@yourhost.com]/root(1): rehash

#### Download via wget or NC Unifi.unix-3.1.4.zip in /tmp


[2.1-RELEASE][root@yourhost.com]/root(1): cd /tmp/
[2.1-RELEASE][root@yourhost.com]/root(1): unzip Unifi.unix-3.1.4.zip
[2.1-RELEASE][root@yourhost.com]/root(1): mv UniFi /usr/local/
[2.1-RELEASE][root@yourhost.com]/root(1): cd usr/local/UniFi/bin
[2.1-RELEASE][root@yourhost.com]/root(1): rm mongod
[2.1-RELEASE][root@yourhost.com]/root(1): ln -s /usr/local/bin/mongod mongod
[2.1-RELEASE][root@yourhost.com]/root(1): /usr/local/etc/rc.d/mongod onestart
[2.1-RELEASE][root@yourhost.com]/root(1): cd /usr/local/UniFi/lib
[2.1-RELEASE][root@yourhost.com]/root(1): java -jar ace.jar start &

If everything is O.K in a 3-5 minutes you will get port 8443
netstat -an | grep 8443

New Member
Posts: 8
Registered: ‎04-06-2013

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

[ Edited ]

I've got pfsense 2.1 release (updated from 2.0.2) and I was trying to update unifi to the lastest beta.  I already had mongodb and openjdk6 installed but I've gone and updated them to the latest versions.  However, when updating I receive the following warnings:

mondogb

pkg_add: warning: package 'mongodb-2.0.4' requires 'pcre-8.30_1', but 'pcre-8.21_1' is installed
pkg_add: warning: package 'mongodb-2.0.4' requires 'pcre-8.30_1', but 'pcre-8.32' is installed
pkg_add: warning: package 'mongodb-2.0.4' requires 'nspr-4.9', but 'nspr-4.8.2' is installed
pkg_add: warning: package 'mongodb-2.0.4' requires 'spidermonkey-1.7.0_1', but 'spidermonkey-1.7.0' is installed
pkg_add: warning: package 'mongodb-2.0.4' requires 'icu-4.8.1.1_1', but 'icu-3.8.1_3' is installed
pkg_add: warning: package 'mongodb-2.0.4' requires 'boost-libs-1.45.0_2', but 'boost-libs-1.43.0' is installed
Package mongodb-2.0.4 registered in /var/db/pkg/mongodb-2.0.4

openjdk7

pkg_add: warning: package 'openjdk-7.2.13' requires 'xextproto-7.2.0', but 'xextproto-7.1.1' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'renderproto-0.11.1', but 'renderproto-0.11' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'recordproto-1.14.1', but 'recordproto-1.14' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'kbproto-1.0.5', but 'kbproto-1.0.4' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'inputproto-2.0.2', but 'inputproto-2.0' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'freetype2-2.4.7', but 'freetype2-2.4.11' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'xproto-7.0.22', but 'xproto-7.0.16' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'libXau-1.0.6', but 'libXau-1.0.5' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'libXdmcp-1.1.0', but 'libXdmcp-1.0.3' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'libICE-1.0.7,1', but 'libICE-1.0.6,1' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'libSM-1.2.0,1', but 'libSM-1.1.1_1,1' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'libxcb-1.7', but 'libxcb-1.6' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'libX11-1.4.4,1', but 'libX11-1.3.3,1' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'libXt-1.0.9,1', but 'libXt-1.0.7' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'libXrender-0.9.6', but 'libXrender-0.9.5' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'libXext-1.3.0_1,1', but 'libXext-1.1.1,1' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'libXi-1.4.3,1', but 'libXi-1.3,1' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'libXtst-1.2.0', but 'libXtst-1.1.0' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'libiconv-1.13.1_2', but 'libiconv-1.13.1_1' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'libiconv-1.13.1_2', but 'libiconv-1.14' is installed
pkg_add: warning: package 'openjdk-7.2.13' requires 'libiconv-1.13.1_2', but 'libiconv-1.14_1' is installed
Package openjdk-7.2.13 registered in /var/db/pkg/openjdk-7.2.13

I've tried force adding the latest versions of the out of date packages for mongodb but it doesn't seem to pick them up (still complains that the older version is installed.)

When unifi starts up I'm getting the following error:

[2013-12-16 09:52:24,469] <db-server> ERROR system - [exec] error, rc=1, output=/libexec/ld-elf.so.1: /usr/local/bin/mongod: Undefined symbol "_ZN5boost6system16generic_categoryEv"

This makes me think that it's failing due to the out of date boost lib.

Any ideas on how I can resolve this?  If I just did a new install of pfsense 2.1, would I have the latest and required pkgs?  Should I bail on this idea and learn how to do the pfsense jail implementation?

New Member
Posts: 3
Registered: ‎12-18-2013

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

Excellent tutorial. I'm in the process of trying this on a VM before trying it on a production machine. One correction:

pkg_add -rv opendjk7

should be

pkg_add -rv openjdk7

It is preatty easy to see during the install and the resulting error, but someone who is just copying the steps and not troubleshooting may run into problems.

Good job!

New Member
Posts: 21
Registered: ‎08-15-2013
Kudos: 4
Solutions: 1

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

I am glad that someone REALLY read what i am writting and see my error in typing.

OpenDjk should be OpenJdk

I will edit the first post as well.
I have tried this in VirtualBox and it's working perfect. Make all test on VM.
Also after i put 3.1.4 in production - BEAWARE there was problems.
You should use lastest STABLE version witch is 2.4.6.

New Member
Posts: 3
Registered: ‎12-18-2013

Re: Tutorial: UniFi 3.1.4 running on pfSense 2.1-RC

This has been really helpful, so thank you for writing. Adding UniFi to a pfsense box was the last thing I needed to figure out to have a one device solution for a client. After some more research, and with your reccomendation, it is apparent that I should not be deploying UniFi 3. I'll stick with the stable versions. Now to see if I can just downgrade my VM box...

Not to be nitpicky, but I think there is another typo. This line:

cd usr/local/UniFi/bin

should read

cd /usr/local/UniFi/bin

A couple snags I ran into with my testing (which are probably apparent to most people):

Make sure the VM hard drive is large enough for both swap and the installs you want to make. I had a VM with 1 GB ram and 2 GB HD and my install of openjdk failed halfway through with a full drive.

Reboot after running through this tutorial. I did not and kept getting jave errors trying to start UniFi. After a reboot, smooth sailing.

All the best!

Reply