1)上传tomcat:到 /usr/java/目录下(若没有java这个目录执行 mkdir java 命令创建)
2)解压:
执行命令:tar -zxvf apache-tomcat-7.0.47.tar.gz
3)启动tomcat:
到tomcat的bin目录下执行: ./startup.sh
4)查看是否启动成功
执行: jps
登陆tomcat欢迎界面: http://ip:8080/
tomcat服务是启动的, 但无法访问服务器上的tomcat应用页面。tomcat默认端口为8080
解决办法:
在防火墙配置中设置端口:
命令:
# cd /etc/sysconfig
# vi iptables
在iptables中加入:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
/etc/init.d/iptables restart #最后重启防火墙使配置生效
关闭命令: service iptables stop
永久关闭防火墙:chkconfig iptables off