jdk的包下载会出现问题,所以最好先自行下载本地。
## zhutongcloud 2019.2.14
#!/bin/bash
##jenkins 构建
##部署git
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -ri '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config
#function git() {
yum install wget curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker -y
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
tar xf git-2.9.5.tar.gz
cd git-2.9.5/
make prefix=/usr/local/git all
make prefix=/usr/local/git install
echo 'PATH=$PATH:$HOME/bin:/usr/local/git/bin' >> /etc/bashrc
source /etc/bashrc
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
git --version
if [ $? -eq 0 ];then
echo "~~~~~~~~~~~~Git is install successful"
else
echo "~~~~~~~~~~~Git is install fail"
fi
#}
##jdk环境部署
# function java() {
wget https://download.oracle.com/otn/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz
tar xvzf jdk-8u151-linux-x64.tar.gz -C /usr/local/
cd /usr/local/
mv jdk1.8.0_151 jdk
echo 'JAVA_HOME=/usr/local/jdk' >> /etc/bashrc
echo 'export PATH=$PATH:$JAVA_HOME/bin' >> /etc/bashrc
sleep 2
source /etc/bashrc
cat `java -version`
echo "!!!!!Java is install successful"
#}
##部署maven
#function maven() {
wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.3/binaries/apache-maven-3.5.3-bin.tar.gz
tar xvzf apache-maven-3.5.3-bin.tar.gz -C /usr/local/
mv /usr/local/apache-maven-3.5.3/ /usr/local/maven
cat >> /etc/bashrc <<
export M2_HOME=/usr/local/maven
export M2=\$M2_HOME/bin
PATH=\$M2:\$PATH:\$HOME/bin:/usr/local/git/bin
export JAVA_HOME=/usr/local/jdk
export PATH
source /etc/bashrc
EOF
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
mvn -version
if [ $? -eq 0 ];then
echo "~~~~~~~~~~~~Maven is install successful"
else
echo "~~~~~~~~~~~~Maven is install failure"
fi
#}
##部署tomcat
#function tomcat() {
wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.16/bin/apache-tomcat-9.0.16.tar.gz
tar xvzf apache-tomcat-9.0.1.tar.gz -C /usr/local/
mv /usr/local/apache-tomcat-9.0.1/ /usr/local/tomcat
echo "CATALINA_HOME=/usr/local/tomcat \n
export CATALINA_HOME" >> /etc/profile
source /etc/profile
echo “~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~”
/usr/local/tomcat/bin/startup.sh
echo "~~~~~~~~Tomcat is install successful"
#}
/usr/local/tomcat/bin/shutdown.sh
##部署jenkins
#function jenkins() {
wget http://mirrors.shu.edu.cn/jenkins/war/2.130/jenkins.war
cp jenkins.war /usr/local/tomcat/webapps/
#}
git;
java;
maven;
tomcat;
/usr/local/tomcat/bin/startup.sh
echo "访问http://ip:8080/jenkins"