1、下载tomcat8
2、上传到服务器,解压、修改名称
[[email protected] work]# tar -zxvf apache-tomcat-8.5.34.tar.gz
[[email protected] work]# mv apache-tomcat-8.5.34 tomcat
将tomcat添加到系统服务
1、把tomcat的脚本文件拷一份到/etc/init.d目录
[[email protected] work]# cd tomcat/bin
[[email protected] bin]# cp catalina.sh /etc/init.d/tomcat
2、修改启动配置,添加以下代码,:wq保存退出
[[email protected] bin]# vi /etc/init.d/tomcat
#chkconfig: 2345 10 90
#description: tomcat service
export JAVA_HOME=/home/soft/jdk
export CATALINA_HOME=/home/work/tomcat
3、添加服务
[[email protected] bin]# chkconfig --add tomcat
[[email protected] bin]# chkconfig --list tomcat
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
tomcat 0:off 1:off 2:on 3:on 4:on 5:on 6:off
4、添加权限
[[email protected] bin]# chown 777 /etc/init.d/tomcat
5、启动tomcat测试
[[email protected] bin]# service tomcat start
访问地址:http://IP:8080/,出现以下界面说明tomcat启动成功,reboot重启服务器后,查看tomcat是否自启