Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

How to install Ubiquiti mFi and/or UniFi software in a FreeNAS jail

Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE
Status
Not open for further replies.

George51

Member
Joined
Feb 4, 2014
Messages
126
Fixed my first issue -
Code:
echo /usr/local/bin/tmux new-window -d "/usr/local/bin/java -jar /UniFi/lib/ace.jar start" >> /etc/rc.local

should have been
Code:
echo /usr/local/bin/tmux new-session -d "/usr/local/bin/java -jar /UniFi/lib/ace.jar start" >> /etc/rc.local


This does allow the 4.8.12 controller to work - now however I adopted the AP, then against better judgment immediately updated the firmware on it - it updated fine. but got stuck in an adopting loop. I couldn't do anything with it despite factory resetting etc. SSH'ing in and using 'info' displayed server reject on the inform ip address. Despite it being the correct one for the jail, thus rendering the AP fairly useless currently
 
Last edited:

George51

Member
Joined
Feb 4, 2014
Messages
126
So I have now got my Unifi Controller working - I ended up using

Code:
pkg install py27-setuptools27 devel/libexecinfo devel/pcre archivers/snappy devel/boost-libs scons v8 R-cran-DBI nano sudo wget tmux openjdk-jre
pkg install mongodb
pkg update && pkg upgrade
edit /etc/fstab

added the following lines
Code:
fdesc /dev/fd fdescfs rw 0 0
proc /proc procfs rw 0 0

Then:
Code:
sysrc mongod_enable="YES"

Restarted the jail
Code:
 service mongod status
cd /
wget https://www.ubnt.com/downloads/unifi/4.7.6/UniFi.unix.zip
unzip UniFi.unix.zip
rm UniFi.unix.zip
rm /UniFi/bin/mongod
ln -s /usr/local/bin/mongod /UniFi/bin/mongod
sysrc local_enable="YES"
echo /usr/local/bin/tmux new-session -d "/usr/local/bin/java -jar /UniFi/lib/ace.jar start" >> /etc/rc.local
chmod +x /etc/rc.local

Restart the jail - and try to access the controller via https://IP.address.of.jail:8443/

Points to note:

It uses new mongodb
It doesn't use openjdk8
It doesn't run controller 4.8.12
Therefore my AP isn't on the latest firmware either.

I downgraded to Java and the controller (and AP firmeware) on the same run - so I don't know which one fixed my issues - but I required WiFi and didn't have time to faff any further.
 
Last edited:

wtfR6a

Member
Joined
Jan 9, 2016
Messages
88
Here's how I finally cracked this nut.
I installed the default unifi package from the ports tree, downloaded the latest unifi.zip from UBNT and unzipped it over the package install files which is basically what their readme said to do.
Rebooted jail, connected browser to 4.8.12, adopted and updated unifi APs to latest beta and went to the pub. Took about 15 minutes from start to finish.
 

George51

Member
Joined
Feb 4, 2014
Messages
126
Here's how I finally cracked this nut.
I installed the default unifi package from the ports tree, downloaded the latest unifi.zip from UBNT and unzipped it over the package install files which is basically what their readme said to do.
Rebooted jail, connected browser to 4.8.12, adopted and updated unifi APs to latest beta and went to the pub. Took about 15 minutes from start to finish.
What mongobd and or java version are you using?
 

wtfR6a

Member
Joined
Jan 9, 2016
Messages
88
What mongobd and or java version are you using?
root@unifi:/usr/local/share/java/unifi/bin # mongod -version
db version v2.6.7
2016-01-10T14:07:38.798-0500 git version: nogitversion
2016-01-10T14:07:38.798-0500 OpenSSL version: OpenSSL 0.9.8za-freebsd 5 Jun 2014

root@unifi:/usr/local/share/java/unifi # java -version
openjdk version "1.8.0_60"
OpenJDK Runtime Environment (build 1.8.0_60-b24)
OpenJDK 64-Bit Server VM (build 25.60-b23, mixed mode)

I recall the issue with adopting the unifi access points is that the dev's have started compressing the traffic/packages between controller and APs now. If you check your logs you'll see the failure point. You can fix it by upgrading snappy-java, i.e

cd /usr/ports/archivers/snappy-java/
make install clean

Its a google thang, for more info see https://github.com/xerial/snappy-java

then you should be good. If I get a bit more time I'll try and provide some step by step instructions. Hope this helps. The version I'm running has been rock solid, including with multicasts for AppleTV/Android Shield/Airtime. The newer version is less so so Ive help back from it for now in production.
 

Attachments

George51

Member
Joined
Feb 4, 2014
Messages
126
If I get a bit more time I'll try and provide some step by step instructions. Hope this helps. The version I'm running has been rock solid, including with multicasts for AppleTV/Android Shield/Airtime. The newer version is less so so Ive help back from it for now in production.
Yes please - step by step would be appreciated. I just tried a fresh jail (installing openjdk8) giving me the same mongodb and java versions as you, I then did

cd /usr/ports/archivers/snappy-java/
make install clean

Following the rest of the guide as before - adopted and upgraded and immediately fell foul of the adopting cycle - tried playing around with snappy-java but didn't have any success. A guide would be greatly appreciated, or at least a kick in the right direction. Cheers
 

DumDum

Neophyte
Joined
Feb 24, 2015
Messages
11
Yes please - step by step would be appreciated. I just tried a fresh jail (installing openjdk8) giving me the same mongodb and java versions as you, I then did

cd /usr/ports/archivers/snappy-java/
make install clean

Following the rest of the guide as before - adopted and upgraded and immediately fell foul of the adopting cycle - tried playing around with snappy-java but didn't have any success. A guide would be greatly appreciated, or at least a kick in the right direction. Cheers
Try copying the built version of the port over the Unifi's version. For me it was:
cp /usr/local/share/java/classes/snappy-java.jar /usr/local/UniFi/lib/snappy-java-1.0.5.jar

(Also, for the overall install, I used a slightly modified script which is intended for pfsense...)
 

George51

Member
Joined
Feb 4, 2014
Messages
126
I am certainly struggling with this one, I am confident it is something (probably obvious) I am missing, but I seem to keep coming across the same brick wall of the adoption loop.
 

wtfR6a

Member
Joined
Jan 9, 2016
Messages
88
Adoption loop is related to that snappy Java thing. Replace the copy in the unifi folder with the updated version as above. You are close....
 

George51

Member
Joined
Feb 4, 2014
Messages
126
Adoption loop is related to that snappy Java thing. Replace the copy in the unifi folder with the updated version as above. You are close....
So you motivated me to have another shot at it - thank you.

I have achieved what I wanted, the following is step by step instructions for anyone else attempting the same thing

Create the jail as per step 1 in the guide

Code:
pkg install py27-setuptools27 devel/libexecinfo devel/pcre archivers/snappy devel/boost-libs scons v8 R-cran-DBI nano sudo wget tmux openjdk8-jre
pkg install mongodb
pkg update && pkg upgrade
edit /etc/fstab

Add the following lines
Code:
fdesc /dev/fd fdescfs rw 0 0
proc /proc procfs rw 0 0

Then:
Code:
sysrc mongod_enable="YES"
cd /
wget https://www.ubnt.com/downloads/unifi/4.8.12/UniFi.unix.zip
unzip UniFi.unix.zip
rm UniFi.unix.zip
rm /UniFi/bin/mongod
ln -s /usr/local/bin/mongod /UniFi/bin/mongod
cd /usr/ports/archivers/snappy-java/
make install clean

I had a lot of questions about files missing etc, it errored out - I am not sure the last two commands are required as i then went on to do:
Code:
cd /
pkg install snappyjava
cp /usr/local/share/java/classes/snappy-java.jar /UniFi/lib/snappy-java-1.0.5.jar
sysrc local_enable="YES"
echo /usr/local/bin/tmux new-session -d "/usr/local/bin/java -jar /UniFi/lib/ace.jar start" >> /etc/rc.local
chmod +x /etc/rc.local


Then I restarted the jail - and accessed the controller via https://IP.address.of.jail:8443/

Adopted the AP, updated the AP, and success(!), it sits there connected and stable, running the latest version of everything.

It took me perhaps longer than it should but I got there! Thanks for the help.
 

wtfR6a

Member
Joined
Jan 9, 2016
Messages
88
great, glad to hear it! thanks for the updated steps too.
 

dvand

Member
Joined
Oct 5, 2014
Messages
35
Followed post #30 and I've been running rock solid for days now. Thanks!

Sent from my XT1095 using Tapatalk
 

Sabbath92

Neophyte
Joined
Mar 1, 2016
Messages
6
The updated steps worked great. Is there a way to update to new versions when they come out?
 

wtfR6a

Member
Joined
Jan 9, 2016
Messages
88

hungarianhc

Member
Joined
Mar 11, 2014
Messages
214
When starting the service with this, I saw an error about tmux unable to access the default session. I realize now that this was because I only installed Unifi, and not mFi, so the new-window was incomplete since new-session is needed at least once first.

Might be useful to note that if you're only installing UniFi, then you should use new-session for it. Your instructions were working so well copy/paste that this hadn't occurred to me originally.

Thanks for the well done instructions!
Cyberjock, Your guide was AWESOME. That being said, since I'm only running UniFi, I stumbled upon the issue that Windle Poons mentioned. I made one quick change, and boom - all good. Can you add this to your post?

Oh and btw... I did this with the most recent version of UniFI, 4.8.14.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Sorry I feel off the face of the earth with this thread. Been plenty busy with work. Can someone confirm the steps to get the latest (currently it looks like 4.8.14) is working. I'll test the steps and, assuming they work fine, I'll update my guide appropriately. :P
 

George51

Member
Joined
Feb 4, 2014
Messages
126
Sorry I feel off the face of the earth with this thread. Been plenty busy with work. Can someone confirm the steps to get the latest (currently it looks like 4.8.14) is working. I'll test the steps and, assuming they work fine, I'll update my guide appropriately. :p
I can confirm my post - post 30 - works. Using "wget https://www.ubnt.com/downloads/unifi/4.8.14/UniFi.unix.zip"

Not convinced
Code:
cd /usr/ports/archivers/snappy-java/
make install clean

Is required, as it produced a lot of errors - so I would try it without these two and just use the lines that I followed with anyway
Code:
pkg install snappyjava
cp /usr/local/share/java/classes/snappy-java.jar /UniFi/lib/snappy-java-1.0.5.jar
 

wtfR6a

Member
Joined
Jan 9, 2016
Messages
88
Snappy-Java was a must install issue on earlier versions to make adoption work, verified with UBNT.

Fresh ports are up to date with 4.8.14 now too.
 

hungarianhc

Member
Joined
Mar 11, 2014
Messages
214
For me, the steps in post 30 worked, and I got 4.8.14 up and running. Been rock solid for over a week. I'm not 100% sure of how to upgrade cleanly... but that's for another day, I suppose.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I've actually decided to hold off on playing with this stuff. It's just not worth my few hours of time for a firmware update when (I think) the pre-10.x jails won't be forward compatible. So I feel like my time is best used elsewhere, and when 10.x comes out then I'll look at new jail instructions. :)
 
Status
Not open for further replies.
Top