tomcat环境简单部署
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tomcat环境简单部署相关的知识,希望对你有一定的参考价值。
1.卸载jdk
rpm -qa|grep java
rpm -e --nodeps 需要卸载的包
2.安装需要的rpm包
rpm -ivh 安装包
3.解压tomcat并设置端口修改开启端口、监听端口、关闭端口
4.配置需要的内存
JAVA_OPTS=‘-Xms1024m -Xmx8196m‘
5.配置开机启动项(centos6、7全部适用)
vi /etc/inin.d/webXXX
#!/bin/sh
# webmpos: Start/Stop/Restart webmpos
# chkconfig: 2345 60 50
# description: Tomcat is a Java Servlet Container
# match these values to your environment:
export CATALINA_BASE=/app/web/mpos
export CATALINA_HOME=/app/web/mpos
export CATALINA_TMPDIR=/app/web/mpos/temp
export JRE_HOME=/usr
# Source function library.
. /etc/init.d/functions TOMCAT=/app/web/mpos
start() {
echo -n "Starting Tomcat: "
#/root/rc.local start
/app/web/mpos/bin/startup.sh start
}
stop() {
echo -n "Stopping Tomcat: "
/app/web/mpos/bin/shutdown.sh stop
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
;;
restart)
stop
sleep 2
start
;;
*)
echo "Usage: $0 {start stop restart}" ;;
esac
exit $RETVAL
chkconfig webXXX on
6.配置防火墙,监听端口
centos6
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
centos7
firewall-cmd --zone=public --add-port=8081/tcp --permanent
systemctl restart firewalld
本文出自 “点滴、幸福” 博客,请务必保留此出处http://fengm.blog.51cto.com/1429593/1891230
以上是关于tomcat环境简单部署的主要内容,如果未能解决你的问题,请参考以下文章