1.安装tomcat7,解压即可
2.在/etc/profile文件中追加tomcat的环境变量
export CATALINA_HOME=/software/apache-tomcat-7.0.55
使用source /etc/profile使配置生效
3.将tomcat配置为服务
将tomcat的脚本文件拷贝到/etc/inti.d目录下
cp catalina.sh /etc/init.d/tomcat7
修改执行的权限
chmod 755 /etc/init.d/tomcat7
接着对拷贝的脚本进行修改,添加chkconfig和description两行注释,同时加上JAVA_HOME和CATALINA_HOME声明
#chkconfig: 2345 10 90
#description: tomcat8 service
export JAVA_HOME=/software/jdk1.7.0_51
export CATALINA_HOME=/software/apache-tomcat-7.0.55
使用chkconfig -add tomcat7 将其添加为服务
chkconfig --add tomcat7
4.配置开机启动
chkconfig tomcat7 on
5.配置防火墙打开80端口
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/etc/init.d/iptables save
service iptables restart