博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
tomcat7+jdk1.8一键安装脚本
阅读量:7040 次
发布时间:2019-06-28

本文共 2255 字,大约阅读时间需要 7 分钟。

1 #!/bin/bash 2 #--------------------------------------------------------------------- 3 # 4 # Author : 大象无形 5 # Date : 2016-11-22 6 # Mail : wxqian_wxq@163.com 7 # Description: Install tomcat7 and JDK1.8 8 # Equipment : 9 # 1)Run this script as root10 #11 #---------------------------------------------------------------------12 13 #Script's structure14 #1)Determines if the root user15 #2)Test the machine JDK version16 #3)Determine if the file exists17 #4)install JDK 18 #5)Add the environment variable to /etc/profile19 #6)Install tomcat20 #7)Configure tomcat21 22 23 #1)Determines if the root user24 if [ "$(whoami)" != 'root' ]; then25 echo "install need root user"26 exit 127 fi28 #2)Test the machine JDK version29 for i in $(rpm -qa | grep java | grep -v grep) 30 do 31 echo "Deleting rpm -> "$i 32 rpm -e --nodeps $i 33 done 34 #3)Determine if the file exists35 file1=./jdk-8u101-linux-x64.tar.gz36 if [ ! -f "$file1" ]; then37 echo "need jdk-8u101-linux-x64.tar.gz"38 exit 139 fi40 41 file2=./apache-tomcat-7.0.73.tar.gz42 if [ ! -f "$flie2" ]; then43 echo "need apache-tomcat-7.0.73.tar.gz"44 exit 145 fi46 #4)install JDK 47 echo "========================jdk is installing======================"48 tar zxvf jdk-8u101-linux-x64.tar.gz 49 mv jdk1.8.0_101 /opt/jdk50 echo "jdk1.8.0_101 is rename jdk"51 sleep 2;52 53 #5)Add the environment variable to /etc/profile54 echo "export JAVA_HOME=/opt/jdk" >> /etc/profile55 echo "export PATH=$JAVA_HOME/bin:$PATH" >> /etc/profile56 echo "export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar" >> /etc/profile57 sleep 2;58 source /etc/profile59 #6)Install tomcat60 echo "====================apache-tomcat is installing==================="61 tar zxvf apache-tomcat-7.0.73.tar.gz62 mv apache-tomcat-7.0.73 /usr/local/tomcat63 cp -p /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat64 #7)Configure tomcat65 sed -i '1a\. /etc/init.d/functions' /etc/init.d/tomcat66 sed -i '2a\:' /etc/init.d/tomcat67 sed -i '3a\JAVA_HOME=/usr/local/jdk/' /etc/init.d/tomcat68 sed -i '4a\CATALINA_HOME=/usr/local/tomcat' /etc/init.d/tomcat69 sleep 5;70 chmod 755 /etc/init.d/tomcat71 chkconfig --add tomcat72 chkconfig tomcat on73 /usr/local/tomcat/bin/startup.sh

 

转载于:https://www.cnblogs.com/itor/p/6259421.html

你可能感兴趣的文章
Linux Ubuntu 16.04 主机名设置
查看>>
CCNP 静态路由
查看>>
单链表二[不带头节点链表]
查看>>
Spring mvc 拦截器
查看>>
MySQL GROUP BY 和GROUP_CONCAT的一些用法
查看>>
## mysqldump 导出数据库各参数详细说明
查看>>
java中URL编码和中文相互转换
查看>>
影评:《云图》:生命并非微不足道
查看>>
hibernate4之一对一关系映射(二)
查看>>
我的友情链接
查看>>
Android第五课 编译错误分析
查看>>
VS_远程调试
查看>>
博为峰Java技术题 ——JavaSE Java实现在不同编码之间进行文件转换
查看>>
Throws与Throw
查看>>
php趣味编程 - php求黑色星期五
查看>>
zabbix安装
查看>>
ELK之权限管理
查看>>
×_7_12_2013 I: Light on or off
查看>>
JIT
查看>>
巧用escalations限制Nagios报警次数 - [Nagios
查看>>