Java linux 机器上 apache-tomcat 的推荐/标准安装路径是什么
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/578073/
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
What is the recommended/standard install path for apache-tomcat on a linux box
提问by David Waters
Hello I am looking to install Apache-Tomcat on a RedHat linux and I am interested if there is a standard place for this to be installed. in other work I have seen tomcat installed at
您好,我想在 RedHat linux 上安装 Apache-Tomcat,如果有一个标准的安装位置,我很感兴趣。在其他工作中,我看到安装了 tomcat
/opt/apache-tomcat-[VERSION]/
/opt/apache-tomcat-[版本]/
but I would expect it to be found under /usr. Best answer will have a link to authoritative site.
但我希望它可以在 /usr 下找到。最佳答案将有权威网站的链接。
Thanks so much,
非常感谢,
David.
大卫。
采纳答案by Steve B.
I don't know if there's such a thing as an "official" place, but a reasonable thing to do would be to do what you've done and refer to tomcat through a softlink at /usr/local/tomcat or some such, which would allow you to upgrade versions by simply installing a new version in opt and changing the softlink.
我不知道是否有“官方”这样的地方,但合理的做法是做你所做的事情,并通过 /usr/local/tomcat 或类似的软链接引用 tomcat,这将允许您通过简单地在 opt 中安装新版本并更改软链接来升级版本。
回答by Andy
It depends on who you ask, but I see it this way:
这取决于你问谁,但我是这样看的:
/opt is typically for third-party add-on software. /usr/ is often for 'system' software. User compiled apps go in /usr/local.
/opt 通常用于第三方附加软件。/usr/ 通常用于“系统”软件。用户编译的应用程序进入 /usr/local。
I put tomcat in /opt/apache-tomcat-VERSION. I then make a symlink to it as /opt/tomcat.
我把 tomcat 放在 /opt/apache-tomcat-VERSION 中。然后我将它的符号链接设为 /opt/tomcat。
The Linux Standards Basemay have more info on the matter.
在Linux标准库可能对此事的更多信息。
回答by spligak
I'm fairly certain it doesn't matter.
我很确定这没有关系。
Just like most well-behaved Java apps look for the JAVA_HOMEenvironment variable to locate the preferred Java installation, once you've set CATALINA_HOMEin either .bashrc or .profile of the affected users, software needing to locate Tomcat should be able to find it.
就像大多数行为良好的 Java 应用程序寻找JAVA_HOME环境变量来定位首选的 Java 安装一样,一旦您在受影响用户的 .bashrc 或 .profile 中设置了CATALINA_HOME,需要定位 Tomcat 的软件应该能够找到它.
回答by gareth_bowles
There's a Red Hat RPM package for Tomcat 6 - just "yum install tomcat6" and it will put everything in the right place for you and fix up the security by running Tomcat as a dedicated user (not to mention taking care of updates and patches by putting Tomcat into the RPM repository).
有一个适用于 Tomcat 6 的 Red Hat RPM 包 - 只是“yum install tomcat6”,它将把所有东西都放在正确的位置,并通过以专用用户身份运行 Tomcat 来修复安全性(更不用说照顾更新和补丁了将 Tomcat 放入 RPM 存储库)。
Most of the executables, the configuration and the webapp directory end up under /var/lib/tomcat6 using this method.
大多数可执行文件、配置和 webapp 目录都使用这种方法在 /var/lib/tomcat6 下结束。
回答by Oliver
Well there is an easy answer for that here, too bad nobody of these high-pointers have listed it:
好吧,这里有一个简单的答案,太糟糕了,这些高分者中没有人列出它:
回答by Jamie
Someone else mentioned http://www.pathname.com/fhs/pub/fhs-2.3.html, which is good information. Unfortunately, they didn't provide any accompanying information with it, aside from a snarky comment.
其他人提到了http://www.pathname.com/fhs/pub/fhs-2.3.html,这是很好的信息。不幸的是,除了尖刻的评论外,他们没有提供任何附带信息。
According to that document, /opt is where installed software would go, so I would recommend /opt/tomcat, and set CATALINA_HOMEto this directory.
根据该文档,/opt 是安装软件的位置,因此我建议使用 /opt/tomcat,并将CATALINA_HOME设置为该目录。
It also says /var is where variable data would go, so I would put it in /var/tomcat and set CATALINA_BASEto this directory.
它还说 /var 是变量数据所在的位置,所以我将它放在 /var/tomcat 并将CATALINA_BASE设置为该目录。
I'll add a little background. If you don't set CATALINA_BASE, then it will default to the same as CATALINA_HOME. However, CATALINA_HOMEshould be the unadulterated install, and should be set as read-only. You should use a different location for variable stuff like your actual web directories and logs. Then, when you need to change versions, it's just as simple as changing CATALINA_HOME. Also, you can run multiple instances of Tomcat more easily without having multiple copies of the same install.
我会添加一点背景。如果您没有设置CATALINA_BASE,那么它将默认为与CATALINA_HOME相同。但是,CATALINA_HOME应该是纯粹的安装,并且应该设置为只读。您应该为可变内容使用不同的位置,例如您的实际 Web 目录和日志。然后,当您需要更改版本时,就像更改CATALINA_HOME一样简单。此外,您可以更轻松地运行 Tomcat 的多个实例,而无需同一安装的多个副本。
Also, don't forget to create a CATALINA_BASE/bin/setenv.sh (or .bat for Windows) file instead of editing CATALINA_HOME/bin/catalina.sh (or .bat for Windows).
另外,不要忘记创建 CATALINA_BASE/bin/setenv.sh(或 Windows 的 .bat)文件,而不是编辑 CATALINA_HOME/bin/catalina.sh(或 Windows 的 .bat)。
Yeah, this is more information than anyone asked for, but hopefully someone will find it useful.
是的,这比任何人要求的信息都多,但希望有人会发现它有用。