I got VPS (Virtual Private Server). and I want to install apache-tomcat with this server. the server's OS is CentOS 64bit. I installed through beneath steps.
Step 1. Installing JDK
cd /usr/tmp
wget http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-x64.rpm
rpm -Uvh jdk-8u51-linux-x64.rpm
Step 2. Installing Tomcat
wget http://apache.tt.co.kr/tomcat/tomcat-8/v8.0.24/bin/apache-tomcat-8.0.24.tar.gz
tar xvfpz apache-tomcat-8.0.24.tar.gz
mv apache-tomcat-8.0.24 /usr/local/tomcat
Step 3. Adding tomcat service wrote beneath shell code and save into /etc/rc.d/init.d/ and change permission by 'chmod 755 /etc/rc.d/init.d/tomcat'
#!/bin/sh
# Startup script for Tomcat
#
# chkconfig: 35 85 15
# description: apache tomcat 6.x
#
# processname: tomcat
#
# Source function library.
export JAVA_HOME=/usr/java/default
export CATALINA_HOME=/usr/local/tomcat
export PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin
# See how we were called.
case "$1" in
start)
echo -n "Starting tomcat: "
$CATALINA_HOME/bin/catalina.sh start
echo
;;
stop)
echo -n "Shutting down tomcat: "
$CATALINA_HOME/bin/catalina.sh stop
echo
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0
Step 4. Run service
chkconfig –add tomcat
service tomcat start
But... I couldn't see cat on server:8080... So I found some document saying open 8080 port on iptables. so I adding this quote
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
But things not changed. still I can't access this server at externally. Even if I stop iptables, iptables6, Can't acess.
Server IP : 168.92.122.39 Domain : 39.vs.woobi.co.kr
FTP 182.162.94.35:53921 -> 192.168.122.39:21
SSH 182.162.94.35:53922 -> 192.168.122.39:22
MYSQL 182.162.94.35:53906 -> 192.168.122.39:3306
I don't know what is problem. I spend so many time with this. please help me!
Instead of using the iptables
command you specified, try the firewall-cmd
command (CentOS 7) or lokkit
(CentOS 6), since these can override iptables rules.
# CentOS 6
lokkit -p 8080:tcp
# CentOS 7
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload
Also check the documentation of your VPS provider. It may be that you must open/forward the port in their user interface as well. I know for example that Amazon requires this.