加入收藏 | 设为首页 | 会员中心 | 我要投稿 源码网 (https://www.900php.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

Install Tomcat 6 on CentOS or RHEL --转载

发布时间:2021-01-25 17:14:03 所属栏目:Linux 来源:网络整理
导读:副标题#e# p class="entryContent"? p class="entryContent"source:http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos p class="entryContent"This post will cover installation and configuration of Tomcat 6 on CentOS 5. We will als

  1. Create the user 'tomcat' and add this user to the tomcat group we created above.


    <div class="dp-highlighter">
    <div class="bar">
    <div class="tools">
    <a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;view plain<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;copy to clipboard<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;print<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;?
  1. [root@blanche?~]#?useradd?-s?/bin/bash?-g?tomcat?tomcat??

The above will create a home directory for the user tomcat in the default user home as /home/tomcat

If we want the home directory to be elsewhere,we simply specify so using the -d switch.


<div class="dp-highlighter">
<div class="bar">
<div class="tools">
<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;view plain<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;copy to clipboard<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;print<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;?

The above will create the user tomcat's home directory as /usr/share/apache-tomcat-6.0.32/tomcat

  1. Change ownership of the tomcat files to the user we created above:


    <div class="dp-highlighter">
    <div class="bar">
    <div class="tools">
    <a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;view plain<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;copy to clipboard<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;print<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;?

Note: it is possible to enhance our security still further by making
certain files and directory read-only. This will not be covered in this
post and care should be used when setting such permissions.

  1. Adjust the start/stop service script we created above. In our new script,we need to su to the user tomcat:


    <div class="dp-highlighter">
    <div class="bar">
    <div class="tools">
    <a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;view plain<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;copy to clipboard<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;print<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;?
  1. ??
  2. ??
  3. ?JAVA_HOME??
  4. ?PATH??
  5. ??
  6. start)??
  7. ;;???
  8. /bin/su?tomcat?$TOMCAT_HOME/shutdown.sh??
  9. restart)??
  10. /bin/su?tomcat?$TOMCAT_HOME/startup.sh??
  11. esac??????

Step 6 (Optional): How to Run Tomcat on Port 80 as Non-Root User.

Note: the following applies when you are running Tomcat in "stand alone"
mode. That is,you are running Tomcat without Apache in front of it.

To run services below port 1024 as a user other than root,you can add the following to your IP tables:


<div class="dp-highlighter">
<div class="bar">
<div class="tools">
<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;view plain<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;copy to clipboard<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;print<a href="http://www.davidghedini.com/pg/entry/install_tomcat_6_on_centos"&gt;?

  1. [root@blanche?~]#?iptables?-t?nat?-A?PREROUTING?-p?udp?-m?udp?--dport?80?-j?REDIRECT?--to-ports?8080????

Learn More About Apache Tomcat

(编辑:源码网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读