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

m0nkey_

Dedicated Sage
Joined
Oct 27, 2015
Messages
2,732
m0nkey_ submitted a new resource:

Installing Ubiquiti UniFi Controller in a jail - Simple how-to to install the UniFi controller in a jail

This is a very basic how-to. I'm going to expand on this later, but this is just a quick "here's how you do it" deal for somebody who was having trouble standing up the UniFi controller. As usual, I will be creating a video for this very simple how-to.

Here's the basics for now:
  • Create jail, enable VIMAGE.
  • SSH to your FreeNAS box and run: jexec <jailname> csh
  • Update pkgs: pkg update && pkg upgrade -y
  • Update ports: portsnap fetch extract
  • Change...
Read more about this resource...
 

techbutton

Neophyte
Joined
Mar 10, 2015
Messages
4
I have a install I built for this https://github.com/TechButton/unifi-controller-freebsd-freenas currently setup to install 5.5.14, this will install snappy java as well. I wrote this to do upgrades as well, backs up your install and then restores the files after the upgrade. You can modify the file with the new version on the forums or I will keep updating this install, I try to get to it every few weeks.

Login with SSH to your FreeNAS (or alternatively go to shell in WebGUI)
type: 'jls' (without ' ' ) and take the note of the # of jail of your Unifi installation
type: jexec # csh' (where # is the number of the jail noted in last step)
type: fetch -o install-unifi.sh https://raw.githubusercontent.com/T...freenas/master/install-unifi/install-unifi.sh
type: chmod 755 install-unifi.sh
type: ./install-unifi.sh
 
Last edited:

m0nkey_

Dedicated Sage
Joined
Oct 27, 2015
Messages
2,732
Why use an un-trusted script when the UniFi controller is in the FreeBSD ports tree?
 

techbutton

Neophyte
Joined
Mar 10, 2015
Messages
4
The plan is to keep moving up with the new versions of FreeNAS not in the port. They roll out a new version in the stable environments we can keep upgrading to that. I believe the current version in the port is 5.4.11, some features in the new versions are needed for users. They will be on the new 5.6.x version soon, and that will bring the USG on par with the Edge routers, this line will keep that up to date. Just offering another way to install the software and controller.
 

m0nkey_

Dedicated Sage
Joined
Oct 27, 2015
Messages
2,732
The plan is to keep moving up with the new versions of FreeNAS not in the port. They roll out a new version in the stable environments we can keep upgrading to that. I believe the current version in the port is 5.4.11, some features in the new versions are needed for users. They will be on the new 5.6.x version soon, and that will bring the USG on par with the Edge routers, this line will keep that up to date. Just offering another way to install the software and controller.
The port maintainer tracks the UniFi releases and updates the port as an when required.

https://www.freshports.org/net-mgmt/unifi5/
 

techbutton

Neophyte
Joined
Mar 10, 2015
Messages
4
Great, once again, the port is 5.4.15 and this will install 5.5.14 and soon 5.6 and the ports are behind the stable releasing they are pushing out new features weekly. Just giving another way to install, not telling everyone they need to us this script, not forcing it on anyone, just giving out other options.
 

m0nkey_

Dedicated Sage
Joined
Oct 27, 2015
Messages
2,732
Great, once again, the port is 5.4.15 and this will install 5.5.14 and soon 5.6 and the ports are behind the stable releasing they are pushing out new features weekly. Just giving another way to install, not telling everyone they need to us this script, not forcing it on anyone, just giving out other options.
The problem here is that a script doesn't teach. While it's nice and convenient, the point of this resource is to teach somebody to install a package from ports, which is a fundamental part of FreeBSD.
 

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
This is hardly worth people getting their knickers in a twist.

I doubt most people would want to, or need, to use the script, to be absolutely most butt-clenchingly updated to the Unifi software, and can't wait a day or two for the ports maintainer to take care of it. So it's really moot.
 

raidflex

Senior Member
Joined
Mar 14, 2012
Messages
486
While I still prefer to use the ports, I did find it lagged about 2-3 weeks behind a release in the past, not sure if this has improved.
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,243
5.4.9 released 1/16/17 => port updated on 1/17/17
5.4.11 released 2/8/17 => port updated on 2/7/17 <=ha port was updated before ubiquity announced
5.4.14 released 4/6/17 => port updated on 4/19/17
5.4.15 released 5/2/17 => port updated on 5/12/17

So it's about 50/50, sometimes it's updated almost exactly when the release happens and other times it takes ~10-13 days. I think most people are probably fine with a week of waiting. You can also update the port yourself if you want. I know feld would love PR's.
 

raidflex

Senior Member
Joined
Mar 14, 2012
Messages
486
5.4.9 released 1/16/17 => port updated on 1/17/17
5.4.11 released 2/8/17 => port updated on 2/7/17 <=ha port was updated before ubiquity announced
5.4.14 released 4/6/17 => port updated on 4/19/17
5.4.15 released 5/2/17 => port updated on 5/12/17

So it's about 50/50, sometimes it's updated almost exactly when the release happens and other times it takes ~10-13 days. I think most people are probably fine with a week of waiting. You can also update the port yourself if you want. I know feld would love PR's.
Generally if everything is working I am in no rush to update anyways, so a couple weeks at most is not a big deal.
 

AVSION

Member
Joined
Dec 28, 2016
Messages
119
Hi Guys,

Following m0nkey_ video, i installed unifi controller 5.4.15 on FreeNAS-11.0-U1 but have some issues login via http://unifi.ubnt.com/ using google chrome i get "error_code": "JNI library is not loaded” when lunching. with the unifi IOS app it's hangs on requesting sdp offer...

i contact unifi support and they respond with the following,

That seems like a Java error... FreeNAS is based on FreeBSD. We only support Debian/Linux, I recommend you dropping this question on our forum/community. Our community users will be happy to assist you with this FreeBSD setup.

when pinging from freenas shell i can only get reply ping unifi.ubnt.com no reply if i use www. or http://

ATM i'm unable to manage the controller remotely only on my local network and wifi. i did open ports on my ERL firewall following unifi recommended used ports but no success.

will appreciate your help

Thank you
 

m0nkey_

Dedicated Sage
Joined
Oct 27, 2015
Messages
2,732
Sorry, can't help you there. Never used the cloud stuff. You may want to reach out to Ubiquiti again, since the controller is Java based and will run on any OS that is capable of running Java.
 

AVSION

Member
Joined
Dec 28, 2016
Messages
119
Thanks for your reply,

So login remotely is available only via my public ip? (just tested it works via public ip)

also just found couple of things

in your instruction note, you mention i need to "install OpenJDK and LLVM via pkg before building UniFi" i think i installed it after building the unifi,
is that have something to do with the cloud issue?

and i just ping with actually unifi ip 54.192.119.53 i got a reply but when i ping youtube and google it resolve the name, if that a dns issue? if so how come it does resolve google.

Thank you
 

ThreeDee

Senior Member
Joined
Jun 13, 2013
Messages
366
works like a charm .. took me 2 tries due to not installing java first the first go around .. Thanks a bunch for the walk through. ;)
 

butchwcassidy

Neophyte
Joined
Jul 16, 2017
Messages
4
First time poster so take it easy on me. Running a clean 11 u1 install and can't get this to work. This is what I did

created dafault jail
opened a terminal in this jail
pkg update && pkg upgrade -y
portsnap fetch extract
cd /usr/ports/net-mgmt/unifi5
pkg install bash llvm40 openjdk8
make install clean BATCH=yes
this is were I start getting errors

env: /usr/local/bin/perl5.24.2: No such file or directory
*** Error code 127

Stop.
make[6]: stopped in /usr/ports/devel/p5-Locale-gettext
*** Error code 1

Stop.
make[5]: stopped in /usr/ports/misc/help2man
*** Error code 1

Stop.
make[4]: stopped in /usr/ports/print/texinfo
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/devel/m4
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/devel/scons
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/databases/mongodb
*** Error code 1

Any help would be appreciated
 

CJDK

Junior Member
Joined
Mar 12, 2017
Messages
22
The build script misses this file /usr/local/bin/perl5.24.2
The one installed is /usr/local/bin/perl5.24.1
I have just renamed the file, lets see if that work. :smile:
 

butchwcassidy

Neophyte
Joined
Jul 16, 2017
Messages
4
Install is going now, Thank you for the quick help.

Edit
Boom, got it working now up and running. Thanks again
 
Last edited:

Baenwort

Member
Joined
Feb 19, 2015
Messages
58
So I updated from 9.10.2-U6 to 11.0-U2 and tried to update from 5.5.19 to 5.5.20.

I get the following error when I try to built and reinstall:
directly prior to this the ports update successfully and the directory is changed and the service is stopped per the directions.
Code:
make: "/usr/ports/Mk/bsd.port.mk" line 1177: UNAME_r (11.0-STABLE) and OSVERSION
(1003000) do not agree on major version number.								
root@unifi_control:/usr/ports/net-mgmt/unifi5 #


Any ideas on how I fix this?
 

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
This almost certainly has to do with you having FreeBSD-10 based jails on a FreeBSD-11 based operating system.

OPtions that come to mind:

1) You could blow away your jails and make new FreeNAS-11 based jails.
2) You can see if someone else with a second opinion and a decent idea for doing this the "right" way without blowing away your jails shows up.
3) There is a "hack" in this thread that almost certainly will work, with the appropriate modification: https://forums.freenas.org/index.php?threads/trouble-update-ports-jail-after-9-10-upgrade.42250/
 
Top