Centos7 yum安装tomcat
Posted cold、liu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 出现以下界面说明成功
以上是关于Centos7 yum安装tomcat的主要内容,如果未能解决你的问题,请参考以下文章
centos7中使用yum安装tomcat以及它的启动停止重启
centos7中使用yum安装tomcat以及它的启动停止重启