Where to install GlassFish on Linux? Where to install GlassFish on Linux? linux linux

Where to install GlassFish on Linux?


There's also the option of using your Linux distro's package management system to install Glassfish. On Ubuntu for example, you could install it using

sudo apt-get install glassfish-appserv

and let it get installed to wherever the package owner thought it should be installed.

I myself tend to steer away from the above option, as I like to exert my own control over which exact version of Glassfish (or any other Java server/software) is installed and where, but I just wanted to throw that out there, as it's one of the things you could do.

Now for the individual options you've provided:

/opt/glassfish/This is the preferred option as far as I'm concerned. It keeps the software on a separate directory outside of the regular Linux installation, and allows the mounting and partitioning benefits you mention.

/usr/local/glassfish/I don't like this much, because /usr/local is generally used by third-party software that is installed using the distro's package management software (apt/yum/etc), and on most distros has directories like bin, etc and lib under it. Putting a directory for glassfish under it, would make it out of place.

Also I prefer to keep system directories separate from custom software that doesn't use the distro's package management tools.

/home/myUsers/glassfish/ , /home/ogs/glassfish

These 2, I would not recommend.

They are only described in most places, because the author doesn't want to assume that the user has root access on those boxes, in which case the home directory would be the only one you'd be guaranteed to own. If you own the system and are managing it, those restrictions don't apply.

Remember, home directories are for specific users. I always recommend server software being managed with individual users' accounts that have the required privileges. Putting software in someone's home directory would mean that you either

  1. Give everyone who needs to manage Glassfish, the password to that user account
  2. Give multiple users read/write access to the home directory of a specific user.

Either way, that's not good system administration policy.

There's not much of a Java perspective here, but if you ask me, there doesn't need to be.


Regarding the prior recommendation, some tradeoffs remain:

  • If placed in /opt or /usr/local, you will have to have read/write access to those directories, meaning that you will have to have root access to the box. In some environments (where IT controls the platform), IT will not let you have root access. You would have to delegate to IT the responsibility of installing, patching, and upgrading the GlassFish binaries.
  • If placed in /opt or /usr/local, then you will also have to place the domain directories (--domaindir) in a separate location unless you want them owned by root (unlikely). This was the default in GlassFish 2.x RPM installs on Linux. GlassFish 3.x does not have RPM installs (from Oracle, anyway), but you can still split the two. This isn't a bad tradeoff, but something you should understand.
    • If placed in a "home directory", then you have rights to upgrade the core binaries, install patches, etc, separate from IT. There is good/bad/ugly in this approach depending on organizational responsibilities.

Hope this helps.