# Install openjdk and mongod on pfsense



## Lockstar (Jun 7, 2016)

Hi Guys

I'm new to pfsense. I've been currenty trying to install openjkd on pfsense through command line. I have already downloaded openjdk-7.0.82-1.tbz package and have tried the pkg add command on it but that fails. I also have mongodb-linux-x86-64-3.2.6.tgz. I would like to install that as well. Is there a command to install both packages through command line.? i would prefer to install these locally then going through internet because i am setup behind a proxy and cant download via the internet. I'm using freebsd 10.3.


----------



## Phishfry (Jun 7, 2016)

Well as I guess you have found out pfSense is locked down. As a firewall appliance it meant to be a firewall. Nothing more.
OpenJDK on a firewall? That sounds like trouble...MongoDB on a firewall machine is not wise.

Here are FreeBSD tools for getting you started.
https://www.freebsd.org/java/
https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-freebsd-10-1

If you insist on a firewall with these features you will probably need to custom build pfSense. Better idea is MongoDB server behind pfSense.


----------



## Lockstar (Jun 7, 2016)

Thanks for the reply. I managed to bypass the proxy to go straight to the internet

I tried this command to install openjdk.......`pkg install openjdk.`.....no success. 
I also tried installing mongodb with this command .......`pkg install mongodb`......._still no success _

For both attempts I can the following message:

```
pkg: No packages available to install matching 'mongodb' have been found in the repositories
pkg: No packages available to install matching 'openjdk' have been found in the repositories[/I]
```
 I'm guessing the current repositories I have on pfsense doesn't hosts the files I'm trying to install. `pkg install nano` and `pkg install iftop` both work and pfsense it able to download them. Is there a way to change the current repository to a another one which hosts the openjdk and mongod packages??


----------



## SirDice (Jun 7, 2016)

PC-BSD, FreeNAS, NAS4Free, and all other FreeBSD Derivatives


----------



## Lockstar (Jun 7, 2016)

I managed to find a solution to my topic. I'm not sure if I should post it here given I just read what SirDice posted. Maybe if its okay I'll just post it here


----------



## kpa (Jun 7, 2016)

PfSense isn't locked down in any way, it just doesn't offer (at least officially) the same options for installing third party software as FreeBSD does. Under the hood pfSense is mostly a FreeBSD system but large part of the developer tools such as c/c++ compilers are missing and lots of the rc(8) system is different. You can install FreeBSD packages on pfSense but you're on your own with support if you do so.


----------



## Lockstar (Jun 8, 2016)

You are right kpa. pfSense doesn't seem to be locked down. At least in the sense that I am still able to install these FreeBSD mongodb and openjdk software. I managed to change the URL repositories from pfSense to FreeBSD and enable the FreeBSD in the conf files.

I changed the repository's URL to thislink: http://pkg.freebsd.org/freebsd:10:x86:64/release_3/All/

Then I ran both these commands

```
pkg update
pkg upgrade -f
```
After that I was able to download openjdk, mongodb, wget and unzip and all installed successfully. I have done this with the latest pfSense running on FreeBSD 10.3.


----------



## Phishfry (Jun 8, 2016)

You say its not locked down but you change to another repository why? I would call it an attempt to limit the software you install on a firewall. Maybe lock is not the correct term. How about restricted. Software inhibited. Some other fluffy term.


----------



## kpa (Jun 8, 2016)

Phishfry said:


> You say its not locked down but you change to another repository why? I would call it an attempt to limit the software you install on a firewall. Maybe lock is not the correct term. How about restricted. Software inhibited. Some other fluffy term.



PfSense can't use the vanilla FreeBSD packages in most cases because they have their own requirements for packages such as no X11 and some other restrictions and the FreeBSD pkg+ports system can not yet provide flexible enough system to mix packages from different repositories that have very different default options. All of those restrictions are totally acceptable and justified if you think of what the pfSense is as a platform. It's a security platform with emphasis on minimal attack surface for potential hackers and that's why all non-essentials are left out of the package repositories. If you need a FreeBSD system where you want to install port X the way you like it, you use FreeBSD, not pfSense.


----------



## Lockstar (Jun 8, 2016)

My reason for changing to a another repository was to install openjdk, and mongod.Both of which did not exist on the default pfsense repository. Given what kpa has said I can understand why that is and the appreciation i have for it as a firewall appliance. If its possible I could use a FreeBSD image instead, and leave out the pfsense. As long as Freebsd meets there requirments:

1. Compatible with the APU router (currently running pfsense) APU specs; 1 serial console, 2 ethernet ports, 2 usb ports, 16GB SSD HD
2.Able to run ubiquity unifi with captive portal (captive portal for ticketing managment)
3.Able to act like a normal router.

Is this all possible for a FREEBSD product to manage on a APU PC??


----------



## kpa (Jun 9, 2016)

I would say yes it could be done in plain FreeBSD but pfSense already offers so much of the functionality that you require that I'd say it's not worth the effort. Namely the captive portal is a tough one to get right using plain FreeBSD.

I would use a separate system for running the database as already suggested above. It's a bad idea to try to create a single "jack of all trades" box that does everything. You'll have a single point of failure and because of the reasons stated it's going to take some customization to bend the pfSense system to your needs, those customizations might become a maintenance liability later on when you try to update your pfSense system.


----------

