在 Linux 上安装 GlassFish 的位置?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10666569/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where to install GlassFish on Linux?
提问by IAmYourFaja
DISCLAIMER:I'm relatively new to Linux. I debated putting this on SuperUser or ServerFault because the answer doesrequire an explanation of Linux as a system (and not a specific programming problem), however I'm interested in this from a Java developer's perspective, and I argue that this is a specific problem because where I install GlassFish greatly impacts my Java configuration, and ultimately, app configuration. Not to mention posting this question on those other sites probably won't garnish any attention from a Java developer, more over system admins, who may not know enough about Java to weigh-in fully on this decision.
免责声明:我对 Linux 比较陌生。我争论将它放在 SuperUser 或 ServerFault 上,因为答案确实需要将 Linux 作为一个系统进行解释(而不是特定的编程问题),但是我从 Java 开发人员的角度对此很感兴趣,我认为这是一个特定的问题,因为我安装 GlassFish 的位置极大地影响了我的 Java 配置,并最终影响了应用程序配置。更不用说在其他网站上发布这个问题可能不会引起 Java 开发人员的任何关注,更多的是系统管理员,他们可能对 Java 了解得不够充分,无法充分考虑这个决定。
I'm trying to decide where to install GlassFish and it seems to me I have (realistically) 4 viable options:
我正在尝试决定在何处安装 GlassFish,在我看来,我(实际上)有 4 个可行的选择:
/opt/glassfish/
/usr/local/glassfish/
/home/myUsers/glassfish/
(which is what all the OGS docs show in their examples)/home/ogs/glassfish
(as its own user, similar to how Apache web server is sometimes setup)
/opt/glassfish/
/usr/local/glassfish/
/home/myUsers/glassfish/
(这是所有 OGS 文档在其示例中显示的内容)/home/ogs/glassfish
(作为它自己的用户,类似于有时设置 Apache Web 服务器的方式)
I'm wondering what the pros (taking into consideration the nature of how Linux treats these directories differently, the FHS, etc.) and cons of each approach are.
我想知道每种方法的优点(考虑到 Linux 如何不同地对待这些目录的性质、FHS 等)和缺点是什么。
I've read that there are mounting/paritioning benefits to installing it under opt/
. However, I normally install 3rd party software to usr/local/
, so I'm a little unsure about that as a strategy.
我已经读到在opt/
. 但是,我通常将 3rd 方软件安装到usr/local/
,所以我有点不确定将其作为一种策略。
The Oracle GlassFish Server (OGS) docs all demonstrate (but never outright recommend) GlassFish being installed under your home directory (home/myUser/
).
Oracle GlassFish Server (OGS) 文档都演示(但从不完全推荐)GlassFish 安装在您的主目录 ( home/myUser/
) 下。
Then again, I've read that it is fairly common to install daemon-type services (which is what I would imagineI would be using GlassFish as - where I start it once and it only comes down for routine maintenance or crashes) as their own user (home/ogs/glassfish/
).
再说一次,我已经读到安装守护程序类型的服务是相当普遍的(这就是我想象的我将使用 GlassFish 作为 - 我启动它一次,它只会在日常维护或崩溃时停止)作为他们的自己的用户 ( home/ogs/glassfish/
)。
I'm surethis decision is also impacted by how I'm going to use GlassFish, so let me qualify this question with a few constraints:
我确信这个决定也受到我将如何使用 GlassFish 的影响,所以让我用一些限制来限定这个问题:
- I intend to deploy 4 OGS instances across 4 VMs on the same physical machine and cluster them into the same domain (1 of the 4 server instances will be the admin server for the domain)
- Several applications will be deployed to this cluster (all 3 non-admin nodes) at the same time, and should be running 24/7/365 except for when they crash (hopefully not often!) or when I need to maintenance or tune them
- Each application will be farily large and I would like to configure them with real admin, not "bare bones" de minimis, default settings
- 我打算在同一台物理机上的 4 个虚拟机上部署 4 个 OGS 实例,并将它们集群到同一个域中(4 个服务器实例中的 1 个将作为域的管理服务器)
- 几个应用程序将同时部署到这个集群(所有 3 个非管理节点),并且应该 24/7/365 运行,除非它们崩溃(希望不是经常!)或者当我需要维护或调整它们时
- 每个应用程序都非常大,我想用真正的管理员配置它们,而不是“裸露的骨头”微不足道,默认设置
If these don't provide specific-enough information to help make this choice, please ask and I can be more specific.
如果这些没有提供足够具体的信息来帮助做出这个选择,请询问,我可以更具体。
I guess, when the dust settles at the end of the day, I'm looking (more or less) for a matrix with each of the four directory options (plus any other obvious ones I've omitted) compared against their respective pros & cons.
我想,当一天结束时尘埃落定时,我正在(或多或少)寻找一个矩阵,其中包含四个目录选项中的每一个(加上我省略的任何其他明显选项)与它们各自的优点进行比较缺点。
采纳答案by Rajesh J Advani
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
还可以选择使用 Linux 发行版的包管理系统来安装 Glassfish。例如,在 Ubuntu 上,您可以使用
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.
我自己倾向于避开上述选项,因为我喜欢自行控制安装 Glassfish(或任何其他 Java 服务器/软件)的确切版本以及安装位置,但我只是想把它扔掉,因为这是你可以做的事情之一。
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.
/opt/glassfish/就我而言,这是首选选项。它将软件保存在常规 Linux 安装之外的单独目录中,并允许您提到的挂载和分区优势。
/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.
/usr/local/glassfish/我不太喜欢这个,因为 /usr/local 通常被使用发行版的包管理软件(apt/yum/etc)安装的第三方软件使用,并且在大多数发行版上都有像 bin 等目录和它下面的 lib。在它下面放一个 glassfish 的目录,会使它不合适。
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
/home/myUsers/glassfish/, /home/ogs/glassfish
These 2, I would not recommend.
这2个,我不推荐。
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.
它们只在大多数地方被描述,因为作者不想假设用户对这些盒子有 root 访问权限,在这种情况下,主目录将是你唯一可以保证拥有的目录。如果您拥有并管理系统,则这些限制不适用。
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
请记住,主目录是针对特定用户的。我总是建议使用具有所需权限的个人用户帐户来管理服务器软件。将软件放在某人的主目录中意味着您要么
- Give everyone who needs to manage Glassfish, the password to that user account
- Give multiple users read/write access to the home directory of a specific user.
- 向需要管理 Glassfish 的每个人提供该用户帐户的密码
- 授予多个用户对特定用户的主目录的读/写访问权限。
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.
这里没有太多的 Java 观点,但如果你问我,没有必要。
回答by John Clingan
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.
- 如果放置在 /opt 或 /usr/local 中,您将必须具有对这些目录的读/写访问权限,这意味着您必须具有对该框的 root 访问权限。在某些环境中(IT 控制平台),IT 不会让您拥有 root 访问权限。您必须将安装、修补和升级 GlassFish 二进制文件的责任委托给 IT。
- 如果放置在 /opt 或 /usr/local 中,那么您还必须将域目录 (--domaindir) 放置在单独的位置,除非您希望它们由 root 拥有(不太可能)。这是 Linux 上 GlassFish 2.x RPM 安装的默认设置。GlassFish 3.x 没有 RPM 安装(无论如何来自 Oracle),但您仍然可以将两者分开。这不是一个糟糕的权衡,但你应该理解。
- 如果放置在“主目录”中,那么您有权升级核心二进制文件、安装补丁等,与 IT 分开。根据组织职责,这种方法有好/坏/丑。
Hope this helps.
希望这可以帮助。