加入收藏 | 设为首页 | 会员中心 | 我要投稿 源码网 (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

Change to the /etc/init.d directory and create a script called 'tomcat' as shown below.


<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?init.d]#?vi?tomcat??

  1. ??
  2. ??
  3. ?JAVA_HOME??
  4. ?PATH??
  5. ??
  6. start)??
  7. ;;???
  8. sh?$CATALINA_HOME/bin/shutdown.sh??
  9. restart)??
  10. sh?$CATALINA_HOME/bin/startup.sh??
  11. esac??????

The above script is simple and contains all of the basic elements you will need to get going.

As you can see,we are simply calling the startup.sh and shutdown.sh
scripts located in the Tomcat bin directory
(/usr/share/apache-tomcat-6.0.32/bin).

You can adjust your script according to your needs and,in subsequent posts,we'll look at additional examples.

CATALINA_HOME is the Tomcat home directory (/usr/share/apache-tomcat-6.0.32)

Now,set the permissions for your script to make it executable:


<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;?

We now use the chkconfig utility to have Tomcat start at boot time. In
my script above,I am using chkconfig: 244 20 80. 2445 are the run
levels and 20 and 80 are the stop and start priorities respectively. You
can adjust as needed.


<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?init.d]#?chkconfig?--level?234?tomcat?on??

Verify it:


<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. tomcat??????????0:off???1:off???2:on????3:on????4:on????5:off???6:off??

Now,let's test our script.

Start 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. Using?CATALINA_BASE:???/usr/share/apache-tomcat-6.0.32??
  2. Using?CATALINA_TMPDIR:?/usr/share/apache-tomcat-6.0.32/temp??
  3. Using?CLASSPATH:???????/usr/share/apache-tomcat-6.0.32/bin/bootstrap.jar??

(编辑:源码网)

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

热点阅读