Tomcat安装,配置
系统环境
CentOS Linux release 7.6.1810 (Core) 64位
前置应用
- JDK
openjdk version “1.8.0_252”
OpenJDK Runtime Environment (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
应用
Apache-Tomcat
- 版本
apache-tomcat-7.0.104.tar.gz
安装
Tomcat下载地址:Tomcat官网
# 转到资源存放目录
cd /usr/local/src
# 下载
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-7/v7.0.104/bin/apache-tomcat-7.0.104.tar.gz
# 解压
tar -zxvf apache-tomcat-7.0.104.tar.gz
# 移动到/usr/local
mv /usr/local/src/apache-tomcat-7.0.104 /usr/local/apache-tomcat-7.0.104
配置
# 编辑文件
cd /usr/local/apache-tomcat-7.0.104/bin/
vim catalina.sh
# 添加配置
CATALINA_HOME=/usr/local/apache-tomcat-7.0.104/
启动测试
./catalina.sh start
出现
Using CATALINA_BASE: /usr/local/apache-tomcat-7.0.104/
Using CATALINA_HOME: /usr/local/apache-tomcat-7.0.104/
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.104//temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/apache-tomcat-7.0.104//bin/bootstrap.jar:/usr/local/apache-tomcat-7.0.104//bin/tomcat-juli.jar
Tomcat started.
# 向外开放8080端口
firewall-cmd --zone=public --add-port=8080/tcp --permanent
访问 localhost:8080
有反应则成功。