• Centos7 yum安装tomcat


    以下操作是在线安装apache-tomcat 需要联网下载包。

    liux系统环境

    [root@localhost ~]# cat /etc/redhat-release 

     CentOS Linux release 7.6.1810 (Core)

    一、环境搭建准备
    1、先到tomcat官网https://tomcat.apache.org/查看下载路径

       我下载的tomcat-8.5.37 如: http://mirrors.shu.edu.cn/apache/tomcat/tomcat-8/v8.5.37/bin/apache-tomcat-8.5.37.tar.gz

     

    2、安装wget

    [root@localhost ~]# yum install -y wget

    3、确认是否安装成功

    [root@localhost ~]# rpm -qa | grep wget

    wget-1.14-18.el7.x86_64

    4、wget下载安装包

    [root@localhost ~]# wget http://mirrors.shu.edu.cn/apache/tomcat/tomcat-8/v8.5.37/bin/apache-tomcat-8.5.37.tar.gz

      [root@localhost ~]# lls

      #在文件中发现此包

      #-rw-r--r--. 1 root root 9653382 12月 12 21:00 apache-tomcat-8.5.37.tar.gz

    
    

    5、选择yum安装tomcat需要的jdk-1.8,就不用再手动配置环境变量。

    [root@localhost ~]# yum -y install java-1.8*

    6、查看JDK版本

    复制代码

     [root@localhost ~]# java -version


     openjdk version "1.8.0_191"
     OpenJDK Runtime Environment (build 1.8.0_191-b12)
     OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

    复制代码

    二、解压并启动
    1、解压

    [root@localhost ~]# tar -zxvf apache-tomcat-8.5.37.tar.gz

     [root@localhost ~]# ll

     # 总用量 9436

      #drwxr-xr-x. 9 root root 220 1月 2 15:08 apache-tomcat-8.5.37

    2、启动tomcat,显示tomcat started就是成功启动    启动- startup.sh    停止-shutdown.sh

    复制代码

     [root@localhost ~]# cd apache-tomcat-8.5.37

    [root@localhost apache-tomcat-8.5.37]# ./bin/startup.sh

      Using CATALINA_BASE: /root/apache-tomcat-8.5.37
      Using CATALINA_HOME: /root/apache-tomcat-8.5.37
      Using CATALINA_TMPDIR: /root/apache-tomcat-8.5.37/temp
      Using JRE_HOME: /usr
      Using CLASSPATH: /root/apache-tomcat-8.5.37/bin/bootstrap.jar:/root/apache-tomcat-8.5.37/bin/tomcat-juli.jar
      Tomcat started.

    复制代码

    3、关闭防火墙

    复制代码
    [root@localhost ~]# systemctl stop firewalld    #关闭防火墙
    [root@localhost ~]# systemctl status firewalld  #查看状态
    [root@localhost ~]# systemctl disable firewalld    #开机自动关闭

    firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld(1)
    复制代码

    4、查看tomcat默认端口8080是否开启

    复制代码
    [root@localhost ~]# netstat -ntlp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
    tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd           
    tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      3832/X              
    tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      3739/dnsmasq        
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      3378/sshd           
    tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      3380/cupsd          
    tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      3655/master         
    tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      9873/sshd: root@pts 
    tcp        0      0 127.0.0.1:6011          0.0.0.0:*               LISTEN      6137/sshd: root@pts 
    tcp        0      0 127.0.0.1:6012          0.0.0.0:*               LISTEN      10234/sshd: root@pt 
    tcp6       0      0 :::8009                 :::*                    LISTEN      9804/java           
    tcp6       0      0 :::3306                 :::*                    LISTEN      7196/mysqld         
    tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd           
    tcp6       0      0 :::8080                 :::*                    LISTEN      9804/java           
    tcp6       0      0 :::6000                 :::*                    LISTEN      3832/X              
    tcp6       0      0 :::22                   :::*                    LISTEN      3378/sshd           
    tcp6       0      0 ::1:631                 :::*                    LISTEN      3380/cupsd          
    tcp6       0      0 ::1:25                  :::*                    LISTEN      3655/master         
    tcp6       0      0 ::1:6010                :::*                    LISTEN      9873/sshd: root@pts 
    tcp6       0      0 ::1:6011                :::*                    LISTEN      6137/sshd: root@pts 
    tcp6       0      0 ::1:6012                :::*                    LISTEN      10234/sshd: root@pt 
    tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      9804/java     
    复制代码

    三、浏览器打开:http://192.168.0.8:8080  出现以下界面说明成功

  • 相关阅读:
    线阵相机、镜头及光源的选型
    查看mysql数据库容量大小
    mysql 表分区操作
    VC++ 全局变量定义
    sql按半小时统计
    sqlserver/mysql按天、按小时、按分钟统计连续时间段数据
    相机光学 接圈
    Excel中如何锁定部分单元格内容不被修改?
    VC++ 捕获不了异常
    mysql 数据库存储路径更改
  • 原文地址:https://www.cnblogs.com/6J2B2/p/12815634.html
Copyright © 2020-2023  润新知