首页 > 代码库 > centos安装tomcat

centos安装tomcat

下载 apache-tomcat-6.0.53.tar.gz

地址http://tomcat.apache.org/download-60.cgi

解压安装

#tar zxvf apache-tomcat-6.0.53.tar.gz
#cp  -a  /home/apache-tomcat-6.0.53 tomcat6/
#cd /usr/local/tomcat6/apache-tomcat-6.0.53/bin
# ./startup.sh 
Using CATALINA_BASE:   /usr/local/tomcat6/apache-tomcat-6.0.53
Using CATALINA_HOME:   /usr/local/tomcat6/apache-tomcat-6.0.53
Using CATALINA_TMPDIR: /usr/local/tomcat6/apache-tomcat-6.0.53/temp
Using JRE_HOME:        /usr/local/java/jdk1.6.0_45/jre
Using CLASSPATH:       /usr/local/tomcat6/apache-tomcat-6.0.53/bin/bootstrap.jar

浏览器打开地址

http://192.168.3.11(虚拟机IP):8080

技术分享

如果打不开,关闭防火墙

# service iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
#

或者编辑防火墙开放8080端口

添加  -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080  -j ACCEPT

# vi /etc/sysconfig/iptables

# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080  -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

保存后,

# service iptables restart
iptables:将链设置为政策 ACCEPT:filter                    [确定]
iptables:清除防火墙规则:                                 [确定]
iptables:正在卸载模块:                                   [确定]
iptables:应用防火墙规则:                                 [确定]

即可访问。

本文出自 “茶叶沫” 博客,请务必保留此出处http://chayemo.blog.51cto.com/13018459/1939494

centos安装tomcat