zoukankan      html  css  js  c++  java
  • centos安装JDK与Tomcat

    一:安装JDK

    官方网站下载

    将压缩包拷贝到/user/java目录下

    解压 

    tar zxvf jdk #下载的JDK压缩包名称 


    配置环境变量

    vi /etc/profile

    添加以下内容

    # set java environment
    export JAVA_HOME=/usr/java/jdk-10.0.1
    export CLASSPATH=.:$JAVA_HOME/lib
    export PATH=$JAVA_HOME/bin:$PATH

    至此,JDK的配置配置完成

    验证JDK是否正确安装,输入以下命令

     java -version

    java version "10.0.1" 2018-04-17
    Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
    Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
    出现以上的提示说明JDK安装成功

    二:安装tomcat

    官方网站下载tomcat压缩包

    解压压缩包

    tar zxvf tomcat  #下载的JDK压缩包名称

    vi /etc/profile #文件中加入以下配置

    # tomcat config
    export CATALINA_HOME=/usr/local/tomcat9/apache-tomcat-9.0.7
    export PATH=$CATALINA_HOME/bin:$PATH

    添加tomcat为服务并开机自启动

    vi /etc/rc.d/init.d/tomcat

    输入以下内容 

    #!/bin/bash
    #
    # kenny kenny.zhou@tom.com
    # /etc/rc.d/init.d/tomcat
    # init script for tomcat precesses
    #
    # processname: tomcat
    # description: tomcat is a j2se server
    # chkconfig: 2345 86 16
    # description: Start up the Tomcat servlet engine.
    export JAVA_HOME=/usr/java/jdk-10.0.1
    export CATALINA_HOME=/usr/local/tomcat9/apache-tomcat-9.0.7
    if [ -f /etc/init.d/functions ]; then
    . /etc/init.d/functions
    elif [ -f /etc/rc.d/init.d/functions ]; then
    . /etc/rc.d/init.d/functions
    else
    echo -e "/atomcat: unable to locate functions lib. Cannot continue."
    exit -1
    fi
    RETVAL=$?
    CATALINA_HOME="/usr/local/tomcat9/apache-tomcat-9.0.7"
    case "$1" in
    start)
    if [ -f $CATALINA_HOME/bin/startup.sh ];
    then
    echo $"Starting Tomcat"
    $CATALINA_HOME/bin/startup.sh
    fi
    ;;
    stop)
    if [ -f $CATALINA_HOME/bin/shutdown.sh ];
    then
    echo $"Stopping Tomcat"
    $CATALINA_HOME/bin/shutdown.sh
    fi
    ;;
    *)
    echo $"Usage: $0 {start|stop}"
    exit 1
    ;;
    esac
    exit $RETVAL

     输入以下命令

    service tomcat start

    service tomcat stop

     至此,tomcat安装成功。

  • 相关阅读:
    MSDTC故障排除,DTCTester用法 (二)
    如何清除WebBrowser的Cookies
    修改远程桌面连接端口3389,RDP-Tcp的portnumber要用十六进制修改
    JavaScript Patterns 4.9 Configuration Objects
    JavaScript Patterns 4.8 Function Properties
    JavaScript Patterns 4.7 Init-Time Branching
    JavaScript Patterns 4.6 Immediate Object Initialization
    JavaScript Patterns 4.5 Immediate Functions
    JavaScript Patterns 4.4 Self-Defining Functions
    JavaScript Patterns 4.3 Returning Functions
  • 原文地址:https://www.cnblogs.com/nation/p/8985140.html
Copyright © 2011-2022 走看看