tomcat部署脚本 shell

此脚本需要提前下载好jdk的包到/root/下

下载jdk的地址为http://www.oracle.com/technetwork/java/javase/downloads/index.html

下载的过程较慢,不推荐使用wget直接拉取jdk包

我准备的是jdk-8u211-linux-x64.tar.gz包

此脚本需要加载环境变量 所以需要用source 来执行脚本

#!/usr/bin/bash
#Author:fanzhu
#自动化部署jdk环境&安装tomcat
tar  xzf jdk-8u211-linux-x64.tar.gz -C /usr/local
mv /usr/local/jdk1.8.0_211  /usr/local/java
echo "export JAVA_HOME=/usr/local/java"  >> /etc/profile
echo 'export PATH=$JAVA_HOME/bin/:$JAVA_HOME/jre/bin/:$PATH' >> /etc/profile
echo 'export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar' >> /etc/profile
echo `java -version`
mkdir -p /data/application
yum -y install wget &> /dev/full
wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.46/bin/apache-tomcat-8.5.46.tar.gz
tar xzf apache-tomcat-8.5.46.tar.gz -C /data/application/
mv /data/application/apache-tomcat-8.5.46  /data/application/tomcat
echo "export TOMCAT_HOME=/data/application/tomcat" >> /etc/profile
echo `/data/application/tomcat/bin/version.sh`
echo `/data/application/tomcat/bin/startup.sh`

你可能感兴趣的:(tomcat部署脚本 shell)