centos 安装tomcat
安装方式源码安装
1. 下载安装包,地址是 http://tomcat.apache.org/download-70.cgi
2. ftp上传文件到 /usr/local 目录下
3. 解压缩文件,命令如下
[root@admin local]# cd /usr/local
[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
4.启动tomcat
[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
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
5. 修改iptables (默认开启了ftp 端口22,参考写就写,我vi命令不熟悉,使用ftp 下载到本地,上传后覆盖就可以了)
---- iptables 文件在 /etc/sysconfig/iptables
添加规则,运行访问8080 端口
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
记得重启iptables 命令如下 service iptables restart
6. 启动tomcat
/usr/local/tomcat/bin/startup.sh
7. 停止tomcat
/usr/local/tomcat/bin/shutdown.sh