Setup Tomcat

Apache Tomcat is an open source web server and servlet container developed by the Apache Software Foundation (ASF)

A. Install tomcat by yum

  1. Install tomcat

    sudo yum -y install tomcat6 tomcat6-webapps tomcat6-admin-webapps
    sudo yum -y install tomcat tomcat-webapps tomcat-admin-webapps
    
  2. Configure tomcat as service

    sudo /sbin/chkconfig tomcat6 on
    sudo /sbin/chkconfig tomcat on
    
  3. Start, stop and restart tomcat

    sudo /sbin/service tomcat6 start
    sudo /sbin/service tomcat6 stop
    sudo /sbin/service tomcat6 restart
    sudo /sbin/service tomcat start
    sudo /sbin/service tomcat stop
    sudo /sbin/service tomcat restart
    
  4. Default tomcat's webapps Location

    /usr/share/tomcat6/webapps
    /usr/share/tomcat/webapps
    

B. Install tomcat by manual

  1. Download and extract tomcat

    cd /tmp
    wget http://www.us.apache.org/dist/tomcat/tomcat-7/v7.0.62/bin/apache-tomcat-7.0.62.tar.gz
    tar xzf apache-tomcat-7.0.62.tar.gz
    mv apache-tomcat-7.0.62 /usr/local/tomcat7
    
  2. Start and stop tomcat

    cd /usr/local/tomcat7
    ./bin/startup.sh
    ./bin/shutdown.sh
    
  3. Configure tomcat as service

    cd /etc/init.d
    vi tomcat
    
    #!/bin/bash
    # description: Tomcat Start Stop Restart
    # processname: tomcat
    # chkconfig: 234 20 80
    CATALINA_HOME=/usr/local/tomcat7
    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
    
    chmod 755 tomcat
    chkconfig --add tomcat
    chkconfig tomcat on
    

Comments

Popular posts from this blog

Reduce TIME_WAIT Socket Connections