验证版本:
1.tomcat版本:tomcat7.0.105
2.linux版本:centos7.4
-
请自行下载安装配置tomcat的服务器环境
本经验仅仅介绍如何配置tomcat的开机自动启动
-
用vi startup.sh文件
-
#chkconfig: 2345 80 90
#description:tomcat auto start
#processname: tomcat
-
先按esc
然后按:键盘
接这个输入wq即可保存退出
-
vi catalina.sh
-
然后输入export按回车开始搜索export
-
export CATALINA_BASE=/home/test/tomcat
export CATALINA_HOME=/home/test/tomcat
export CATALINA_TMPDIR=/home/test/tomcat
/home/test/tomcat为tomcat的安装目录
-
先按esc
然后按:键盘
接这个输入wq即可保存退出
-
ln -s /home/test/tomcat/bin/startup.sh /etc/rc.d/init.d/tomcat7
通过上面的命令将startup.sh文件连接到init.d目录下名称为tomcat7
-
关于服务的一些命令:
chkconfig –list #列出所有的系统服务
chkconfig –add httpd #增加httpd服务
chkconfig –del httpd #删除httpd服务
chkconfig –level httpd 2345 on #设置httpd在运行级别为2、3、4、5的情况下都是on(开启)的状态
chkconfig –list #列出系统所有的服务启动情况
chkconfig –list mysqld #列出mysqld服务设置情况
chkconfig –level 35 mysqld on #设定mysqld在等级3和5为开机运行服务,–level 35表示操作只在等级3和5执行,on表示启动,off表示关闭
chkconfig mysqld on #设定mysqld在各等级为on,“各等级”包括2、3、4、5等级如何增加一个服务:
1.服务脚本必须存放在/etc/ini.d/目录下;
2.chkconfig –add servicename
在chkconfig工具服务列表中增加此服务,此时服务会被在/etc/rc.d/rcN.d中赋予K/S入口了;
3.chkconfig –level 35 mysqld on
修改服务的默认启动等级。
参考资料:https://jingyan.baidu.com/article/6525d4b1382f0aac7d2e9421.html
![linux教程:[4]配置Tomcat开机启动](https://exp-picture.cdn.bcebos.com/1f9feadca039131f4b4bd66de275f2c4ed990a3f.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1)
![linux教程:[4]配置Tomcat开机启动](https://exp-picture.cdn.bcebos.com/edd84743040148fe93e558df8fd149299b88023f.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1)
![linux教程:[4]配置Tomcat开机启动](https://exp-picture.cdn.bcebos.com/486884883913e8e57849a808352f477047187d3f.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1)
![linux教程:[4]配置Tomcat开机启动](https://exp-picture.cdn.bcebos.com/bf6e59704618dfda7e9c3e3289214f579256773f.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1)
![linux教程:[4]配置Tomcat开机启动](https://exp-picture.cdn.bcebos.com/03605157935653bb5887614f1d0b31210461713f.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1)
![linux教程:[4]配置Tomcat开机启动](https://exp-picture.cdn.bcebos.com/974a2f21056104a3f34e861a63d7592ae2ef6b3f.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1)
![linux教程:[4]配置Tomcat开机启动](https://exp-picture.cdn.bcebos.com/e996472ae3efe078b896da02b96c576698cf653f.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1)
![linux教程:[4]配置Tomcat开机启动](https://exp-picture.cdn.bcebos.com/332d496699cf02539dc426316b36e29146e85f3f.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1)
·![linux教程:[4]配置Tomcat开机启动](https://exp-picture.cdn.bcebos.com/22c4fe36e29147e884473cc6b603bbea3f86583f.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1)
![linux教程:[4]配置Tomcat开机启动](https://exp-picture.cdn.bcebos.com/46a92de039723d03014d3b32bb486143d6d4573f.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1)
![linux教程:[4]配置Tomcat开机启动](https://exp-picture.cdn.bcebos.com/3c42a5ea3e863048dce4d260c33104ebf7a7523f.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1)
![linux教程:[4]配置Tomcat开机启动](https://exp-picture.cdn.bcebos.com/3fc72e486143d7d4f796015f7da75f0f832b503f.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1)
![linux教程:[4]配置Tomcat开机启动](https://exp-picture.cdn.bcebos.com/6002c9d4483104eb37005abb092b74ee1d324e3f.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500%2Climit_1)