centos7.6 安装Tomcat-8.5.39的方法

时间:2021-05-19

下面给大家介绍centos7.6 安装Tomcat-8.5.39的方法,具体内容如下所示:

#关闭防火墙systemctl stop firewalld.servicesystemctl disable firewalldsetenforce 0sed -i '/SELINUX=/ s/enforcing/disabled/' /etc/selinux/config#linux 更新yum源 改成阿里云源yum install wget vim -y#mkdir -pv /etc/yum.repos.d/bak#mv -if /etc/yum.repos.d/* /etc/yum.repos.d/bak#a=`cat /etc/redhat-release |awk '{print $4}'|awk -F . '{print $1}'`#if [ $a == 6 ];then# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo#else# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo#fi#yum clean all#yum makecache#yum update#装机必备yum install gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel openssl openssl-devel tar unzip zip autoconf libtool make -y#安装JDKyum remove -y java*.x86_64yum -y remove java-1.7.0-openjdk* yum -y remove java-1.8.0-openjdk*yum install java-1.8.0-openjdk* -yjava -versionjavac -version#安装Tomcattar -xzvf /opt/soft/apache-tomcat-8.5.39.tar.gz -C /usr/local/mv -f /usr/local/apache-tomcat-8.5.39 /usr/local/tomcat8.5.39chmod 777 /usr/local/tomcat8.5.39/bin/*.shcp /opt/soft/tomcat /etc/init.d/chmod 755 /etc/init.d/tomcat/etc/init.d/tomcat restartchkconfig --add tomcatchkconfig tomcat on

Tomcat启停脚本

#!/bin/bash# description: Tomcat7 Start Stop Restart# processname: tomcat7# chkconfig: 234 20 80CATALINA_HOME=/usr/local/tomcat8.5.39case $1 in start) sh $CATALINA_HOME/bin/startup.sh ;; stop) ps -e|grep java|awk '{print "kill -9 "$1}'|sh # sh $CATALINA_HOME/bin/shutdown.sh ;; restart) ps -e|grep java|awk '{print "kill -9 "$1}'|sh sleep 3 # sh $CATALINA_HOME/bin/shutdown.sh sh $CATALINA_HOME/bin/startup.sh ;; *) echo 'please use : tomcat {start | stop | restart}' ;;esacexit 0

总结

以上所述是小编给大家介绍的centos7.6 安装Tomcat-8.5.39的方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章