安装说明 安装环境:CentOS-7.0.1406 安装方式:源码安装 软件:apache-tomcat-7.0.29.tar.gz 下载地址:http://tomcat.apache.org/download-70.cgi 安装前提 系统必须已安装配置JDK6+,安装请参考:在CentOS-6.3中安装与配置JDK-7。 安装tomcat 将apache-tomcat-7.0.29.tar.gz文件上传到/usr/local中执行以下操作: 代码如下: 01.[root@admin local]# cd /usr/local 02.[root@admin local]# wget http://apache.fayea.com/apache-mirror/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57.tar.gz 03.[root@admin local]# tar -zxv -f apache-tomcat-7.0.29.tar.gz // 解压压缩包 04.[root@admin local]# rm -rf apache-tomcat-7.0.29.tar.gz // 删除压缩包 05.[root@admin local]# mv apache-tomcat-7.0.29 tomcat [root@admin local]# cd /usr/local [root@admin local]# wget http://apache.fayea.com/apache-mirror/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57.tar.gz [root@admin local]# tar -zxv -f apache-tomcat-7.0.29.tar.gz // 解压压缩包 [root@admin local]# rm -rf apache-tomcat-7.0.29.tar.gz // 删除压缩包 [root@admin local]# mv apache-tomcat-7.0.29 tomcat 启动Tomcat 执行以下操作: 代码如下: 01.[root@admin ~]# /usr/local/tomcat/bin/startup.sh //启动tomcat 02.Using CATALINA_BASE: /usr/local/tomcat 03.Using CATALINA_HOME: /usr/local/tomcat 04.Using CATALINA_TMPDIR: /usr/local/tomcat/temp 05.Using JRE_HOME: /usr/java/jdk1.7.0/jre 06.Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar [root@admin ~]# /usr/local/tomcat/bin/startup.sh //启动tomcat Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/java/jdk1.7.0/jre Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar 出现以上信息说明已成功启动。 防火墙开放8080端口 增加8080端口到防火墙配置中,执行以下操作: [root@admin ~]# vi + /etc/sysconfig/iptables [root@admin ~]# vi + /etc/sysconfig/iptables #增加以下代码 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT 重启防火墙 [root@admin java]# service iptables restart [root@admin java]# service iptables restart 检验Tomcat安装运行 通过以下地址查看tomcat是否运行正常: http://192.168.15.231:8080/ 看到tomcat系统界面,说明安装成功! 停止Tomcat [root@admin ~]# /usr/local/tomcat/bin/shutdown.sh //停止tomcat (责任编辑:IT) |