tomcat安装
1、环境
centos 7.4
阿里云服务器
2核4G
2、确定tomcat安装的版本,本次安装tomcat版本为 v8.5.37
https://tomcat.apache.org/ #官网地址
3、下载tomcat安装包
wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.37/bin/apache-tomcat-8.5.37.tar.gz
4、下载JDK安装包,先安装JDK
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
mkdir /usr/java
tar -zxvf jdk-8u201-linux-x64.tar.gz -C /usr/java
ls /usr/java/jdk1.8.0_201
vim /etc/profile #配置环境变量
export JAVA_HOME=/usr/java/jdk1.8.0_201
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
source /etc/profile #生效
java -version #验证命令
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
5、开始安装tomcat
mkdir /usr/local/tomcat1 #创建目录
tar -xf apache-tomcat-8.5.37.tar.gz -C /usr/local/tomcat1 #解压
vim /usr/local/tomcat1/apache-tomcat-8.5.37/bin/setenv.sh #配置内存
JAVA_OPTS="-Xms1024m -Xmx1024m -Xss1024K -XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=128m"
chmod +x /usr/local/tomcat1/apache-tomcat-8.5.37/bin/setenv.sh #赋予执行权限
/usr/local/tomcat1/apache-tomcat-8.5.37/bin/startup.sh #启动tomcat
6、测试tomcat是否配置启动,打开网页
默认端口8080
确认端口已经全部开放