一、linux虛擬機下載maven和java並進行配置html
(wget http: / /mirror.bit.edu.cn/apache /maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz)java
參考博客:https://liuyanzhao.com/8662.htmllinux
下載war包,上傳到linux虛擬機,執行命令java -jar jenkins.war --httpPort=9000啓動jenkinsapache
二、系統設置,配置maven依賴包的本地下載地址:安全
配置jenkins客戶端的連接地址:bash
三、全局安全設置:maven
四、憑據設置,能夠生產隨機驗證碼:工具
五、全局工具配置:spa
配置執行腳本插件
添加分部署部署插件:
多節點部署腳本更新:
source /etc/profile
cp /dev/null nohup.out
pid=`ps -ef | grep demo-1.0-SNAPSHOT.jar | grep -v grep | awk '{print $2}'`
if [ -n "$pid" ]
then
kill -9 $pid
fi
file1="/opt/Product/demo-1.0-SNAPSHOT.jar"
if [ -f "$file1" ]
then
mv /opt/Product/demo-1.0-SNAPSHOT.jar /opt/Product/demo-1.0-SNAPSHOT-`date +%Y%m%d%H%M%S`.jar
fi
cp /opt/resource/test/demo/target/demo-1.0-SNAPSHOT.jar /opt/Product/demo-1.0-SNAPSHOT.jar
nohup java -jar /opt/Product/demo-1.0-SNAPSHOT.jar &
sleep 10s
stop.sh
#!/bin/bash
echo "Stopping SpringBoot Application"
pid=`ps -ef | grep demo-1.0-SNAPSHOT.jar | grep -v grep | awk '{print $2}'`
if [ -n "$pid" ]
then
kill -9 $pid
fi
repalace.sh#!/bin/bashfile="/opt/Product/demo-1.0-SNAPSHOT.jar"if [ -f "$file" ]then mv /opt/Product/demo-1.0-SNAPSHOT.jar /opt/Product/demo-1.0-SNAPSHOT-`date +%Y%m%d%H%M%S`.jarficp /root/.jenkins/workspace/test/demo/target/demo-1.0-SNAPSHOT.jar /opt/Product/test/demo-1.0-SNAPSHOT.jar