cd /opt/ wget apache-tomcat-7.0.47.tar.gz tar zxf apache-tomcat-7.0.47.tar.gz ln -s apache-tomcat-7.0.47 tomcat nano /etc/init.d/tomcat
#!/bin/sh # # tomcat Starts Tomcat. # # # chkconfig: 345 88 12 # description: Apache Tomcat Server. ### BEGIN INIT INFO # Provides: $tomcat ### END INIT INFO ulimit -Hn 16384 ulimit -Sn 16384 CATALINA_HOME=/opt/tomcat; export CATALINA_HOME start() { echo -n "Starting Tomcat: " $CATALINA_HOME/bin/startup.sh sleep 2 } stop() { echo -n "Stopping Tomcat: " $CATALINA_HOME/bin/shutdown.sh } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo $"Usage: tomcat {start|stop|restart}" exit esac
chmod +x /etc/init.d/tomcat service tomcat start
nano /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
service iptables restart iptables -L