xiguaqq20 发表于 2018-12-3 10:17:54

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
  




页: [1]
查看完整版本: tomcat环境简单部署