1、下载jdk(Java se)和tomcat
axel https://mirrors.aliyun.com/apache/tomcat/tomcat-8/v8.5.32/bin/apache-tomcat-8.5.32.tar.gz
axel http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz?AuthParam=1531539959_12517e81547e230361990d0e4a7eb030
2、解压jdk和tomcat 并移动到软件目录下,并做软连接
tar xf jdk-8u171-linux-x64.tar.gz
mv jdk1.8.0_171 /application/
ln -s /application/jdk1.8.0_171/ /application/jdk
tar xf apache-tomcat-8.5.32.tar.gz
mv apache-tomcat-8.5.32 /application/
ln -s /application/apache-tomcat-8.5.32 /application/tomcat
3、添加java环境变量,查看java版本
vim /etc/bashrc
export JAVA_HOME=/application/jdk
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
export TOMCAT_HOME=/application/tomcat
source /etc/bashrc
echo 'export TOMCAT_HOME=/application/tomcat' >>/etc/bashrc
source /etc/bashrc
4、创建tomcat用户并授权
useradd tomcat
chown -R tomcat.tomcat /application/tomcat/
5、启动服务,进行测试
su - tomcat -c ‘/application/tomcat/bin/startup.sh’
打开网址输入你主机ip:8080 看能否打开tomcat的主界面