一、配置环境
安装环境: centos6.7 jdk1.8.0 tomcat8.5
1、到官网下载tomcat
二、下载安装tomcat
1、通过xsheel工具rz命令上传tomcat安装包到centos系统(安装lrzsz命令 # yum -y install lrzsz)
2、解压安装包 tar -xzvf apache-tomcat-8.5.32.tar.gz
三、运行配置tomcat
1、跳转到tomcat目录下的bin目录下,执行./startup.sh启动服务
2、在防火墙中打开8080端口:firewall-cmd –zone=public –add-port=8080/tcp –permanent
3、重启防火墙 :systemctl restart firewalld.service
4、远程访问即可:http://IP地址:8080/
四、设置服务开机启动
1、vim /etc/init.d/tomcat
#!/bin/bash # # tomcat startup script for the Tomcat server # # chkconfig: 345 80 20 # description: start the tomcat deamon # # Source function library . /etc/rc.d/init.d/functions prog=tomcat JAVA_HOME=/usr/local/java/jdk1.8.0_171 export JAVA_HOME CATALANA_HOME=/usr/local/apache-tomcat-8.5.32/ export CATALINA_HOME case "$1" in start) echo "Starting Tomcat..." $CATALANA_HOME/bin/startup.sh ;; stop) echo "Stopping Tomcat..." $CATALANA_HOME/bin/shutdown.sh ;; restart) echo "Stopping Tomcat..." $CATALANA_HOME/bin/shutdown.sh sleep 2 echo echo "Starting Tomcat..." $CATALANA_HOME/bin/startup.sh ;; *) echo "Usage: $prog {start|stop|restart}" ;; esac exit 0
2、配置
chmod +x /etc/init.d/tomcat chkconfig tomcat on service tomcat start
原文地址:https://www.cnblogs.com/raorao1994/p/9496303.html
时间: 2024-10-24 05:54:33