zoukankan      html  css  js  c++  java
  • 安装配置Tomcat

    1、关闭防火墙和安全机制

    [root@localhost ~]# systemctl stop firewalld
    [root@localhost ~]# iptables -F
    [root@localhost ~]# setenforce 0

    2、查看JDK是否安装

    [root@localhost ~]# java -version
    openjdk version "1.8.0_222"
    OpenJDK Runtime Environment (build 1.8.0_222-b10)
    OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

    3、卸载用rpm方式安装的JDK

    法一、

    [root@localhost ~]# rpm -qa | grep -i openjdk
    java-1.8.0-openjdk-headless-1.8.0.222.b10-0.el7_6.x86_64
    java-1.8.0-openjdk-1.8.0.222.b10-0.el7_6.x86_64
    
    [root@localhost ~]# rpm -e java-1.8.0-openjdk --nodeps   //有依赖关系,解除依赖关系后面加 --nodeps
    [root@localhost ~]# rpm -e java-1.8.0-openjdk-headless
    [root@localhost ~]# rpm -qa | grep -i openjdk

    法二、

    [root@localhost ~]# which java
    /usr/bin/java
    
    [root@localhost ~]# rm -rf /usr/bin/java
    
    [root@localhost ~]# java -version
    -bash: /usr/bin/java: 没有那个文件或目录

     4、安装JDK

    [root@localhost ~]# tar -xf jdk-8u191-linux-x64.tar.gz
    
    [root@localhost ~]# mv jdk1.8.0_191/ /usr/local/java  //将解压后的包移动到指定目录下
    
    [root@localhost ~]# /usr/local/java/bin/java -version  //此时只有通过绝对路径才可以查看java的版本号信息
    
    [root@localhost ~]# vim /etc/profile  //修改
    
    export JAVA_HOME=/usr/local/java  //设置java的根目录
    
    export PATH=$PATH:$JAVA_HOME/bin  //在PATH环境变量中添加java根目录下的bin子目录
    
    [root@localhost ~]# echo $PATH  //在未执行修改的脚本时查看PATH变量
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin  
    [root@localhost ~]# source /etc/profile  //重置一下脚本
    [root@localhost ~]# echo $PATH  //再查一遍
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/java/bin

    5、Tomcat安装

    [root@localhost ~]# tar -xf apache-tomcat-8.5.16.tar.gz
    
    [root@localhost ~]# mv apache-tomcat-8.5.16 /usr/local/tomcat8
    
    [root@localhost ~]# ls /usr/local/tomcat8/bin
    bootstrap.jar setclasspath.sh
    catalina.bat shutdown.bat
    catalina.sh shutdown.sh
    catalina-tasks.xml startup.bat
    commons-daemon.jar startup.sh (启动文件)
    commons-daemon-native.tar.gz tomcat-juli.jar
    configtest.bat tomcat-native.tar.gz
    configtest.sh tool-wrapper.bat
    daemon.sh tool-wrapper.sh
    digest.bat version.bat
    digest.sh version.sh
    setclasspath.bat
    
    //.bat  Windows版本
    
    //.sh   Linus版本

    6、启动

    [root@localhost ~]# /usr/local/tomcat8/bin/startup.sh 
    Using CATALINA_BASE: /usr/local/tomcat8
    Using CATALINA_HOME: /usr/local/tomcat8
    Using CATALINA_TMPDIR: /usr/local/tomcat8/temp
    Using JRE_HOME: /usr/local/java
    Using CLASSPATH: /usr/local/tomcat8/bin/bootstrap.jar:/usr/local/tomcat8/bin/tomcat-juli.jar
    Tomcat started.
    
    [root@localhost ~]# netstat -anpt | grep :8080
    tcp6 0 0 :::8080 :::* LISTEN 3226/java
  • 相关阅读:
    小程序排错(redis导致)
    linux系统删除-开头文件或目录
    nginx 反向代理
    memcache
    一次故障过程
    json.Decoder vs json.Unmarshal
    ssl中间证书
    作业10:String类
    Angular6如何引入jQuery-knob
    OpenJdk源码下载
  • 原文地址:https://www.cnblogs.com/tanxiaojuncom/p/11526681.html
Copyright © 2011-2022 走看看