# @Author: peizhouyu# @Date: 2018-09-07 14:24:11# @Last Modified by: peizhouyu# @Last Modified time: 2018-09-07 16:02:58#!/bin/bashSOFT_PATH=/opt/softif [ ! -d $SOFT_PATH ];thenmkdir $SOFT_PATHelseecho "文件夹已经存在"fiyum install -y wget #install jdk1.8cd $SOFT_PATHwget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"tar -zxvf jdk* -C $SOFT_PATHcd jdk*JAVA_HOME=`pwd` #install maven3.2.3cd $SOFT_PATHwget https://archive.apache.org/dist/maven/maven-3/3.2.3/binaries/apache-maven-3.2.3-bin.tar.gztar -zxvf apache-maven-3.2.3-bin.tar.gz -C $SOFT_PATHmv apache-maven-3.2.3 maven-3.2.3cd maven*MAVEN_HOME=`pwd`#install git 2.8.0cd $SOFT_PATHyum -y install zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils- MakeMakerwget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.8.0.tar.gztar -zxvf git-2.8.0.tar.gz -C $SOFT_PATHcd git*./configuremake installln -s /usr/local/bin/git /usr/bin/git#追加环境变量echo "export JAVA_HOME=${JAVA_HOME}" >> /etc/profileecho "export PATH=$""JAVA_HOME/bin:$""PATH" >> /etc/profileecho "export MAVEN_HOME=${MAVEN_HOME}" >> /etc/profileecho "export PATH=$""MAVEN_HOME/bin:$""PATH" >> /etc/profilesource /etc/profile#输出信息echo "-----source update-----"echo "java version"java -versionecho "maven version"mvn -vecho "-----path-----"echo "JAVA_HOME:"$JAVA_HOMEecho "MAVEN_HOME:"$MAVEN_HOME
可执行赋权:
#给deploy.sh可执行权限chmod a+x deploy.sh #或chmod -R 777 deploy.sh