How to install tomcat on linux


 

1. Downloadtomcat 7 from apache's website.

 

   My downloaded package isapache-tomcat-7.0.32.tar.gz

 

2. Extract thepackage to /usr/share directory.

 

   # tar xzvf apache-tomcat-7.0.32.tar.gz
   # mv apache-tomcat-7.0.32 /usr/share


 

   Now in /usr/share folder there is a apache-tomcat-7.0.32 folder.

   You can also change this folder name totomcat7 or others you like.

   So far tomcat can works if you import it to eclipse.

 

3. ConfigureTomcat to Run as a Service

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

 

   # cd /etc/init.d 
   # vi tomcat

  

 Add the below item in tomcat file then save.

 

#!/bin/bash
# description:Tomcat Start Stop Restart
# processname:tomcat
# chkconfig: 23420 80
JAVA_HOME=/usr/lib/jvm/jdk1.7.0
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/share/apache-tomcat-7.0.32
 
case $1 in
start)
sh$CATALINA_HOME/bin/startup.sh
;;
stop)  
sh$CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh$CATALINA_HOME/bin/shutdown.sh
sh$CATALINA_HOME/bin/startup.sh
;;
esac   
exit 0


 

   set the permissions to make it executable.

 

   

# chmod 755 tomcat

 

   now use the chkconfig utility to have tomcat start at boot time

 

# chkconfig --add tomcat 
# chkconfig --level 234 tomcat on


   Verify it:

   

# chkconfig --list tomcat

 

   Start tomcat:

   

# service tomcat start

   

   Stop tomcat

   

# service tomcat stop


   Restarting tomcat (Must be started first):

   

# service tomcat restart

 

   We should review the Catalina.out loglocated at /usr/share/apache-tomcat-7.0.32/logs/catalina.out

   and check for any errors.

   

# more/usr/share/apache-tomcat-7.0.32/logs/catalina.out

 

   We can now access the Tomcat Manager page at:

 

   http://yourdomain.com:8080 or http://yourIPaddress:8080 and we should see the Tomcat home page.

 

   Until now on, tomcat can be used. There are some other features can be configed, detailed information

   in this link:http://www.davidghedini.com/pg/entry/install_tomcat_7_on_centos



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值