1、下载tomcat8
2、上传到服务器,解压、修改名称
[root@instance-q7vjqvds work]# tar -zxvf apache-tomcat-8.5.34.tar.gz
[root@instance-q7vjqvds work]# mv apache-tomcat-8.5.34 tomcat
将tomcat添加到系统服务
1、把tomcat的脚本文件拷一份到/etc/init.d目录
[root@instance-q7vjqvds work]# cd tomcat/bin
[root@instance-q7vjqvds bin]# cp catalina.sh /etc/init.d/tomcat
2、修改启动配置,添加以下代码,:wq保存退出
[root@instance-q7vjqvds 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、添加服务
[root@instance-q7vjqvds bin]# chkconfig --add tomcat
[root@instance-q7vjqvds 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、添加权限
[root@instance-q7vjqvds bin]# chown 777 /etc/init.d/tomcat
5、启动tomcat测试
[root@instance-q7vjqvds bin]# service tomcat start
访问地址:http://IP:8080/,出现以下界面说明tomcat启动成功,reboot重启服务器后,查看tomcat是否自启