centos6配置tomcat7为服务并开机启动

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

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值