zoukankan      html  css  js  c++  java
  • 【转】在CentOS上安装tomcat

    原文链接:http://www.cnblogs.com/xsi640/p/3757015.html

    另外一个比较详细的博文:http://blog.csdn.net/zhngjan/article/details/25223423

    CentOS 7环境配置tomcat7开机启动  https://blog.csdn.net/tiantang_1986/article/details/53704966

    先从tomcat网站上下载最新的gz安装包

    文件名:apache-tomcat-8.0.8.tar.gz

    将文件上传到/usr/local目录中

    执行解压缩

    tar zxvf apache-tomcat-8.0.8.tar.gz

    将目录apache-tomcat-8.0.8命名为tomcat

    mv apache-tomcat-8.0.8 tomcat

    运行/usr/local/tomcat/bin/startup.sh就会启动tomcat

    配置自动启动脚本:

    #!/bin/bash
    #
    # tomcat startup script for the Tomcat server
    #
    # chkconfig: 345 80 20
    # description: start the tomcat deamon
    #
    # Source function library
    . /etc/rc.d/init.d/functions
    
    prog=tomcat
    JAVA_HOME=/usr/java/jdk1.8.0_05
    export JAVA_HOME
    CATALANA_HOME=/usr/local/tomcat
    export CATALINA_HOME
    
    case "$1" in
    start)
        echo "Starting Tomcat..."
        $CATALANA_HOME/bin/startup.sh
        ;;
    
    stop)
        echo "Stopping Tomcat..."
        $CATALANA_HOME/bin/shutdown.sh
        ;;
    
    restart)
        echo "Stopping Tomcat..."
        $CATALANA_HOME/bin/shutdown.sh
        sleep 2
        echo
        echo "Starting Tomcat..."
        $CATALANA_HOME/bin/startup.sh
        ;;
    
    *)
        echo "Usage: $prog {start|stop|restart}"
        ;;
    esac
    exit 0
     

    将文件命名为tomcat放到/etc/init.d/目录下

    修改权限,可以运行

    chmod +x /etc/init.d/tomcat

    设置开机自动启动服务

    sudo chkconfig tomcat on

    启动服务:

    service tomcat start

    停止服务:

    service tomcat stop

    配置防火墙打开对应的端口:

    vi /etc/sysconfig/iptables
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

     重启防火墙

    service iptables restart
  • 相关阅读:
    HttpRunnerManager使用(一)
    python入门(七):字符串
    python入门(六):函数
    python入门(五):切片列表元祖字典
    python入门(四):字符串、编码、random
    HttpRunnerManager安装部署
    python入门(三):循环
    python入门(二):isinstance、内置函数、常用运算等
    js 去掉空格
    JQ赋值
  • 原文地址:https://www.cnblogs.com/wuling129/p/4764351.html
Copyright © 2011-2022 走看看