简体   繁体   English

在Linux上安装GlassFish的位置?

[英]Where to install GlassFish on Linux?

DISCLAIMER: I'm relatively new to Linux. 免责声明:我对Linux比较陌生。 I debated putting this on SuperUser or ServerFault because the answer does require 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. 我讨论过将它放在SuperUser或ServerFault上是因为答案确实需要将Linux解释为系统(而不是特定的编程问题),但是我从Java开发人员的角度对此感兴趣,并且我认为这是一个特定的问题,因为我安装GlassFish的地方会极大地影响我的Java配置,最终影响应用配置。 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. 更不用说在其他网站上发布这个问题可能不会引起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/myUsers/glassfish/ (这是所有OGS文档在他们的例子中显示的内容)
  • /home/ogs/glassfish (as its own user, similar to how Apache web server is sometimes setup) /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/ . 我已经读过在opt/下安装它有好处/分区好处。 However, I normally install 3rd party software to usr/local/ , so I'm a little unsure about that as a strategy. 但是,我通常会将第三方软件安装到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 imagine I 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 sure this 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) 我打算在同一台物理计算机上的4个虚拟机上部署4个OGS实例,并将它们集中到同一个域中(4个服务器实例中的1个将成为域的管理服务器)
  • 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 多个应用程序将同时部署到此群集(所有3个非管理节点),并且应该全天候运行,除非它们崩溃(希望不经常!)或我需要维护或调整它们
  • Each application will be farily large and I would like to configure them with real admin , not "bare bones" de minimis, default settings 每个应用程序将非常大,我想用真正的管理员配置它们,而不是“裸骨”de minimis,默认设置

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. 我想,当尘埃落定到一天结束时,我正在(或多或少)寻找一个矩阵,其中包含四个目录选项中的每一个(加上我省略的任何其他明显的选项)与他们各自的专业人员相比利弊。

There's also the option of using your Linux distro's package management system to install Glassfish. 还可以选择使用Linux发行版的软件包管理系统来安装Glassfish。 On Ubuntu for example, you could install it using 例如,在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. / opt / glassfish /就我而言,这是首选方案。 It keeps the software on a separate directory outside of the regular Linux installation, and allows the mounting and partitioning benefits you mention. 它将软件保存在常规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. / usr / local / glassfish /我不太喜欢这个,因为/ usr / local通常由使用发行版的软件包管理软件(apt / yum / etc)安装的第三方软件使用,并且在大多数发行版上都有像bin这样的目录和它下面的lib。 Putting a directory for glassfish under it, would make it out of place. 将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. 这两个,我不推荐。

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 为需要管理Glassfish的每个人提供该用户帐户的密码
  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. 这里没有太多的Java观点,但如果你问我,就没有必要。

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. 如果放在/ opt或/ usr / local中,则必须具有对这些目录的读/写访问权限,这意味着您必须具有对该框的root访问权限。 In some environments (where IT controls the platform), IT will not let you have root access. 在某些环境中(IT控制平台),IT不会让您拥有root访问权限。 You would have to delegate to IT the responsibility of installing, patching, and upgrading the GlassFish binaries. 您必须委派IT负责安装,修补和升级GlassFish二进制文件。
  • 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). 如果放在/ opt或/ usr / local中,那么您还必须将域目录(--domaindir)放在一个单独的位置,除非您希望它们由root拥有(不太可能)。 This was the default in GlassFish 2.x RPM installs on Linux. 这是Linux上GlassFish 2.x RPM安装的默认设置。 GlassFish 3.x does not have RPM installs (from Oracle, anyway), but you can still split the two. GlassFish 3.x没有安装RPM(无论如何都是来自Oracle),但你仍然可以拆分这两个。 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. 如果放在“主目录”中,则您有权升级核心二进制文件,安装补丁程序等,与IT分开。 There is good/bad/ugly in this approach depending on organizational responsibilities. 根据组织职责,这种方法有好/坏/丑。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM