unofficial-unifi / unifi-pfsense

A script that installs the UniFi Controller software on pfSense and other FreeBSD systems
BSD 2-Clause "Simplified" License
736 stars 240 forks source link

Java not installed? #198

Closed yvnggodemis closed 3 years ago

yvnggodemis commented 3 years ago

I ran the install script, and even the newest one posted to a comment earlier about it not being able to install the 8.x packages. But when I go to run the unifi.sh script. It says /usr/local/bin/java no found

But I don't know how to install it manually. If I try to install openjdk or snappyjava it just says that it isn't found in the repos

Anyone else be able to help me? I can't find any forms for installing java on pfsense

gnkidwell commented 3 years ago

Try this one please... fetch -o - https://raw.githubusercontent.com/gozoinks/unifi-pfsense/fb58446615f59e582c6eefa406e75e9c984abd3f/install-unifi/install-unifi.sh | sh -s

yvnggodemis commented 3 years ago

Sorry about this, I actually figured it out. I had to enable FreeBSD packages in the repo configuration. However, after running the install script I did receive this error: WARN Unable to load properties from '/usr/local/UniFi/data/system.properties' - /usr/local/UniFi/data/system.properties (No such file or directory)

Should I try to run the script you just posted and see if that works?

gnkidwell commented 3 years ago

That is a normal WARN message. You should be good to go.... No need to run another script.

yvnggodemis commented 3 years ago

Awesome thank you :)

gnkidwell commented 3 years ago

Awesome thank you :)

Not a problem :)

yvnggodemis commented 3 years ago

Sorry to keep you coming back haha, but it did start and I could immediatly get to the interface. I had to restart the pfsense router because I added a new interface, and now after about 5 minutes I can't get to the page on port 8443 and the console of pfsense is coming up with this error: Port 8080 not available.

I'm not sure if it's related. But it only comes up when I start the service.

So I guess my question is, is the problem where it takes forever to start still a problem? or do you think something is wrong?

gnkidwell commented 3 years ago

You could try to uninstall and reinstall or rerun the script.... By adding a new interface, are you meaning actual hardware or just like a vlan under PFSense interfaces? You have me curious I am going to see if I can replicate the problem at home as well. Of course my setup at home is a single nic Lenovo M92P Tiny... So nothing about my setup is normal as far as a PFSense install goes...

gnkidwell commented 3 years ago

Lets try this, since I am guessing you added a hardware interface based upon needing to restart.... We will try a remove and reinstall...

service unifi.sh stop

rm -rf /usr/local/UniFi rm /usr/local/etc/rc.d/unifi.sh

fetch -o - https://raw.githubusercontent.com/gozoinks/unifi-pfsense/fb58446615f59e582c6eefa406e75e9c984abd3f/install-unifi/install-unifi.sh | sh -s

yvnggodemis commented 3 years ago

I added a new physical interface to the VM, to then make it into VLANS for WLAN.

And I have to say you're one of the most helpful devs I've ever talked to on github

Adding the new interface and attempting to restart the machine, before reinstalling caused a crash. So I started a snapshot, added the new interface and configured how I wanted and then reinstalled the software.

I then got the error that's supposed to happen, the normal warning message and the web page came up.

I'm going to attempt to configure the AC Pro that I have on the interface now. This is the first time I'm working with unifi products so we'll see how it goes.

yvnggodemis commented 3 years ago

However, now the controller isn't seeing the device that's plugged into the router.

yvnggodemis commented 3 years ago

Nevermind, I got that working. It wasn't showing up on the other interface I had for some reason. I may need to work on that AFTER the access point is setup.

I think it may need to initialize before setting it up on an interface that has VLANS

gnkidwell commented 3 years ago

I added a new physical interface to the VM, to then make it into VLANS for WLAN.

And I have to say you're one of the most helpful devs I've ever talked to on github

Adding the new interface and attempting to restart the machine, before reinstalling caused a crash. So I started a snapshot, added the new interface and configured how I wanted and then reinstalled the software.

I then got the error that's supposed to happen, the normal warning message and the web page came up.

I'm going to attempt to configure the AC Pro that I have on the interface now. This is the first time I'm working with unifi products so we'll see how it goes.

Glad to hear you have it running again. Honestly the only reason I got involved in github was due to trying to get Unifi to install on PFSense. I have not been involved with this project for very long, but I am hoping to see the merger of my pull occur at some point. I am just glad to see other people getting it to work. The only issue I seem to have is with Cloud Access, but this seems to be an issue with all non Unifi Cloud Key devices and the Dream Machine Pro post version 5.9... If that is the only thing not working, I am okay with that. Besides a proper VPN is probably the best thing to utilize anyway...

gnkidwell commented 3 years ago

Nevermind, I got that working. It wasn't showing up on the other interface I had for some reason. I may need to work on that AFTER the access point is setup.

I think it may need to initialize before setting it up on an interface that has VLANS

Okay I am going to throw some ideas in here... A couple things I would like to know, what is your network topology like? Something the Unifi access points look for is an untagged vlan, so whether this is an untagged vlan by default, most managed switches have an untagged vlan on every port on vlan id 1 by default. Aside from enterprise switches, that do not always have a configuration in place.

Also the Unifi controller by default in PFSense connects to all interfaces, which is not exactly ideal. I found this when I tried to run WebRTC (not functional for non Unifi hardware past version 5.9)... I have my WAN, Management LAN, and an additional 5 VLANs on top of that... With that being said, I do not want the Unifi Controller accessible on all interfaces. In fact, I would say in an ideal network environment, your Unifi hardware would be under your Management LAN or a Management VLAN. So let's get started with some simple modifications.... Below is a link explaining the Unifi system.properties file. https://help.ui.com/hc/en-us/articles/205202580-UniFi-Explaining-the-system-properties-File

If you have some experience with vi, I would vi edit this file. This file is located under /usr/local/UniFi/data ... cd /usr/local/UniFi/data vi system.properties At the end of the file insert: system_ip:"put the ip address of the gateway for your lan or vlan you want to use for management"

Below is an example on my current configuration file for the Unifi controller.

image

After you do that press esc, then type :wq then press enter. service unifi.sh stop service unifi.sh start

This will effectively change your system_ip for the Unifi controller. Also you will want to create firewall rules, if you decide to have your Unifi controller and your access points on separate lans or vlans. Also if you do that, you will be required to ssh the individual access points to set the inform ip address for the access points to connect to the controller. If you have any more questions feel free to ask.

yvnggodemis commented 3 years ago

I got it up and running!!!!! I was right, I did have to initialize the AP first. All I did was plug it into my LAN switch, set it up with the default IP's I wanted, rebooted/plugged it into the interface for the WLAN VLAN tags.

Here is my sorry excuse for a network map

image

gnkidwell commented 3 years ago

I got it up and running!!!!! I was right, I did have to initialize the AP first. All I did was plug it into my LAN switch, set it up with the default IP's I wanted, rebooted/plugged it into the interface for the WLAN VLAN tags.

Here is my sorry excuse for a network map

image

Awesome glad to hear you got it working... Also for future reference I just spent a couple more hours tracking down errors the script was giving... I created a new link, this will install on any PFSense 2.4.5 (amd64 based) Unifi 6.0.23 with no errors. I tested this in a vm, and exported a text file to ensure that all dependencies were installing before their applications... Woot, hoping this gets merged soon... Spent a lot of time of time on this :)....

fetch -o - https://git.io/JUyQX | sh -s

gnkidwell commented 3 years ago

Hey @jbrotosky I went ahead and updated the link to install 6.0.24, please give it a try and leave a review under #201

fetch -o - https://git.io/JUSab | sh -s

yvnggodemis commented 3 years ago

Thank you so much for all your help. But does the controller still take forever to start?

gnkidwell commented 3 years ago

Thank you so much for all your help. But does the controller still take forever to start?

It should not be taking forever to start. Sometimes the end of the script looks like it is taking forever, but once it says Starting UniFi controller it should be up regardless of not seeing your next root prompt. ;)

yvnggodemis commented 3 years ago

yeah it does that but I can't hit the webpage, and I'm getting an error that says root: Port 8080 not available which is weird since it runs on 8443 lol

gnkidwell commented 3 years ago

yeah it does that but I can't hit the webpage, and I'm getting an error that says root: Port 8080 not available which is weird since it runs on 8443 lol

Have you tried doing a full uninstall of the controller? If not try that, but give it a reboot as well... In fact I would backup your settings from the controller, do a remove, then reboot, and then reinstall. I had a similar issue with a certain beta controller version that caused the same thing to happen on an update of the controller. I followed the above method, and it fixed the problem. Sometimes FreeBSD holds onto ports... FYI 8080 is for the controller inform, so that port is very important, so if that port was not available, the controller may hang to start even though the web UI is on 8443....

yvnggodemis commented 3 years ago

Hmm, I rebooted and kill the java process that was running on 8080 and it still won't launch the UI

gnkidwell commented 3 years ago

Hmm, I rebooted and kill the java process that was running on 8080 and it still won't launch the UI

Did you uninstall it as well or just reboot? The uninstall is important here...

yvnggodemis commented 3 years ago

I was hoping I didn't have to uninstall cause I don't have my settings backed up, but I guess that's what i'm going to have to do lol

gnkidwell commented 3 years ago

What version were you last on that was working? Have you tried to go back to that prior version to backup your settings? You could also copy your config over from the directory.

yvnggodemis commented 3 years ago

6.0.23 I think

gnkidwell commented 3 years ago

6.0.23 I think

Try this link. This will put you back on 6.0.23.

fetch -o - https://git.io/JUyQX | sh -s

Do you need help backing up your controller config manually?

gnkidwell commented 3 years ago

@jbrotosky take a look at #211 they just released the official release of 6.0.28.

mfsirilo commented 3 years ago

Sorry about this, I actually figured it out. I had to enable FreeBSD packages in the repo configuration. However, after running the install script I did receive this error: WARN Unable to load properties from '/usr/local/UniFi/data/system.properties' - /usr/local/UniFi/data/system.properties (No such file or directory)

Should I try to run the script you just posted and see if that works?

Hi good night, how did you manage to solve the issue of java not installed? How did you enable FreeBSD packages?

yvnggodemis commented 3 years ago

/usr/local/etc/pkg/repos/pfSense.conf

Edit the file above. The first line should say something like { FreeBSD : no } change this to say yes, then it should install Java

gnkidwell commented 3 years ago

/usr/local/etc/pkg/repos/pfSense.conf

Edit the file above. The first line should say something like { FreeBSD : no } change this to say yes, then it should install Java

That is not even required if you run my script. Just take a look at #211 ... My updates to the script do not require the FreeBSD repo being set to yes. 😉

mfsirilo commented 3 years ago

thank you!! It worked. I am using pfSense version 2.4.5-RELEASE-p1 (amd64). The only thing I used differently about this installation was the zfs file system. I thought about using the pattern to see if it was related, but activating the repository solved the problem. Thank you very much. :)

gnkidwell commented 3 years ago

This issue has been resolved with the latest script. Closing this for now.