当前位置:网站首页>jenkins安装部署过程简记
jenkins安装部署过程简记
2020-11-06 21:40:00 【会开车的架构师】
linux环境搭建jenkins过程
1、下载jenkins包、jdk、maven包、tomcat包或jboss
2、解压安装jdk,设置环境变量
3、解压安装maven包,设置maven-home环境变量
4、解压安装tomcat环境,tomcat用的jdk与环境变量中一致
5、解压部署jenkins,
例子按将jenkins放到tomcat下,并且启动tomcat形式启动jenkins
或者考虑部署到jboss下,准备好相关容器资源
启动后登陆jenkins网址,如http://172.22.12.224:8080/jenkins/
登录的账户密码
下载插件,进入管理插件,在高级中根据网络配置代理和端口
(1)下载插件: JDK Parameter Plugin、Maven Integration plugin、Publish Over SSH、Subversion Plug-in
(2)配置全局变量:jenkins-系统设置-Global Tool Configuration
(a)jdk安装,设定名字,与linux上的jdk路径
jdk1.7.0_75
/root/jenkins/jdk1.7.0_75
(b) maven安装,设定名字,与准备好的maven路径
apache-maven-2.2.1
/root/jenkins/apache-maven-2.2.1
(c)需要注意的事,maven 修改setting内容,包含私服地址、代理、存储下载包位置(根据特定项目而定,我们项目mvn2.2.1才行)
(3)jenkins-系统管理-系统设置
(a) 设定Jenkins URL http://172.22.12.224:8080/jenkins/
(b)设定Publish over SSH - Passphrase 登陆jenkins的密码
(c) SSH Servers 远程服务器登陆信息(远程服务器的账户密码和初始路径)
(d) 测试登陆成功
6、创建配置
(一)创建配置
1、选“新建” 进入,输入一个配置名称(修改有困难)
2、选择“构建一个maven”项目(按此举例)
3、点击OK
(二)编辑配置
1、源代码管理
(1)Repository URL 输入svn代码地址
(2)Credentials 配置svn账户密码
2、Pre Steps 是下载代码后,编译代码打包之前,这个期间过程(可以做差异化部署,修改部分文件之类)
3、Build
(1)Root POM:pom.xml
(2)Goals and options:clean install -Dmaven.test.skip=true
(3)高级
Settings file 与 Global Settings file 可以选择全局配置的参数
4、Post Steps
(一)添加一个 Send files or execute commands over SHH
(二)配置SSH Publishers
1、SSH SERVER 选择初始化的服务器
2、Transfers:
Source files =falcon-controller/target/falcon-controller.war
Remove prefix=falcon-controller/target/
Remote directory =/
3、Exec command (执行脚本,区分tomcat部署和jboss 部署,二选一即可)
#tomcat部署
serverName=tomcat-8390
serverTemp=/opt/app/jenkins/temptomcat/tomcat-8390/temp
serverWork=/opt/app/jenkins/temptomcat/tomcat-8390/work
serverBin=/opt/app/jenkins/temptomcat/tomcat-8390/bin
deployPath=/opt/app/jenkins/temptomcat/tomcat-8390/webapps/
copyPath=/opt/app/jenkins/tmp
warName=falcon-controller.war
warFile=falcon-controller
#shutdown
cd $serverBin
ps -ef | grep -v grep | grep tomcat-8390 | awk '{print $2}' | xargs kill -9
#delete
rm -rf $deployPath$warName
rm -rf $deployPath$warFile
rm -rf $serverTemp
mkdir $serverTemp
rm -rf $serverWork
mkdir $serverWork
#copy
cp $copyPath/$warName $deployPath
#run
cd $serverBin
nohup ./startup.sh &
#判断是否可访问
STATUS_CODE=0
echo $STATUS_CODE
while [[ $STATUS_CODE != 200 ]]
do
STATUS_CODE=`curl -o /dev/null -s -w %{http_code} http://172.22.12.224:8380/falcon-controller/test.html`
#这个地址为tomcat启动后的地址,根据自己定义
done
#-----------------------------------------------------------------------------------------------------------------------
#jboss 部署
serverName=falconA-API
serverTemp=/opt/app/jboss-eap-5.2A/jboss-as/server/falconServer-web/temp
serverWork=/opt/app/jboss-eap-5.2A/jboss-as/server/falconServer-web/work
serverBin=/opt/app/jboss-eap-5.2A/jboss-as/server/falconServer-web/bin
deployPath=/opt/app/jboss-eap-5.2A/jboss-as/server/falconServer-web/deploy/
copyPath=/opt/app/jenkins/tmp
warName=falcon-controller.war
warFile=falcon-controller
#shutdown
cd $serverBin
ps -ef | grep -v grep | grep falconServer-web | awk '{print $2}' | xargs kill -9
#delete
rm -rf $deployPath$warName
rm -rf $deployPath$warFile
rm -rf $serverTemp
mkdir $serverTemp
rm -rf $serverWork
mkdir $serverWork
#copy
cp $copyPath/$warName $deployPath
export JAVA_HOME=/opt/app/jdk/jdk1.6.0_31
export CLASSPATH=$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
#run
cd $serverBin
nohup ./startfalconServer-web.sh &
#判断是否可访问
STATUS_CODE=0
echo $STATUS_CODE
while [[ $STATUS_CODE != 200 ]]
do
STATUS_CODE=`curl -o /dev/null -s -w %{http_code} http://172.22.12.224:8380/falcon-controller/test.html`
done
7、立即构建(即为启动配置)
1、在 构建历史Build History中找到历史,点击右侧向下小箭头,点击Console Output 即可看到编译的日志
2、前面圆形图片为蓝色,即构建成功
linux环境搭建jenkins过程
1、下载jenkins包、jdk、maven包、tomcat包或jboss
2、解压安装jdk,设置环境变量
3、解压安装maven包,设置maven-home环境变量
4、解压安装tomcat环境,tomcat用的jdk与环境变量中一致
5、解压部署jenkins,
例子按将jenkins放到tomcat下,并且启动tomcat形式启动jenkins
或者考虑部署到jboss下,准备好相关容器资源
启动后登陆jenkins网址,如http://172.22.12.224:8080/jenkins/
登录的账户密码
下载插件,进入管理插件,在高级中根据网络配置代理和端口
(1)下载插件: JDK Parameter Plugin、Maven Integration plugin、Publish Over SSH、Subversion Plug-in
(2)配置全局变量:jenkins-系统设置-Global Tool Configuration
(a)jdk安装,设定名字,与linux上的jdk路径
jdk1.7.0_75
/root/jenkins/jdk1.7.0_75
(b) maven安装,设定名字,与准备好的maven路径
apache-maven-2.2.1
/root/jenkins/apache-maven-2.2.1
(c)需要注意的事,maven 修改setting内容,包含私服地址、代理、存储下载包位置(根据特定项目而定,我们项目mvn2.2.1才行)
(3)jenkins-系统管理-系统设置
(a) 设定Jenkins URL http://172.22.12.224:8080/jenkins/
(b)设定Publish over SSH - Passphrase 登陆jenkins的密码
(c) SSH Servers 远程服务器登陆信息(远程服务器的账户密码和初始路径)
(d) 测试登陆成功
6、创建配置
(一)创建配置
1、选“新建” 进入,输入一个配置名称(修改有困难)
2、选择“构建一个maven”项目(按此举例)
3、点击OK
(二)编辑配置
1、源代码管理
(1)Repository URL 输入svn代码地址
(2)Credentials 配置svn账户密码
2、Pre Steps 是下载代码后,编译代码打包之前,这个期间过程(可以做差异化部署,修改部分文件之类)
3、Build
(1)Root POM:pom.xml
(2)Goals and options:clean install -Dmaven.test.skip=true
(3)高级
Settings file 与 Global Settings file 可以选择全局配置的参数
4、Post Steps
(一)添加一个 Send files or execute commands over SHH
(二)配置SSH Publishers
1、SSH SERVER 选择初始化的服务器
2、Transfers:
Source files =falcon-controller/target/falcon-controller.war
Remove prefix=falcon-controller/target/
Remote directory =/
3、Exec command (执行脚本,区分tomcat部署和jboss 部署,二选一即可)
#tomcat部署
serverName=tomcat-8390
serverTemp=/opt/app/jenkins/temptomcat/tomcat-8390/temp
serverWork=/opt/app/jenkins/temptomcat/tomcat-8390/work
serverBin=/opt/app/jenkins/temptomcat/tomcat-8390/bin
deployPath=/opt/app/jenkins/temptomcat/tomcat-8390/webapps/
copyPath=/opt/app/jenkins/tmp
warName=falcon-controller.war
warFile=falcon-controller
#shutdown
cd $serverBin
ps -ef | grep -v grep | grep tomcat-8390 | awk '{print $2}' | xargs kill -9
#delete
rm -rf $deployPath$warName
rm -rf $deployPath$warFile
rm -rf $serverTemp
mkdir $serverTemp
rm -rf $serverWork
mkdir $serverWork
#copy
cp $copyPath/$warName $deployPath
#run
cd $serverBin
nohup ./startup.sh &
#判断是否可访问
STATUS_CODE=0
echo $STATUS_CODE
while [[ $STATUS_CODE != 200 ]]
do
STATUS_CODE=`curl -o /dev/null -s -w %{http_code} http://172.22.12.224:8380/falcon-controller/test.html`
#这个地址为tomcat启动后的地址,根据自己定义
done
#-----------------------------------------------------------------------------------------------------------------------
#jboss 部署
serverName=falconA-API
serverTemp=/opt/app/jboss-eap-5.2A/jboss-as/server/falconServer-web/temp
serverWork=/opt/app/jboss-eap-5.2A/jboss-as/server/falconServer-web/work
serverBin=/opt/app/jboss-eap-5.2A/jboss-as/server/falconServer-web/bin
deployPath=/opt/app/jboss-eap-5.2A/jboss-as/server/falconServer-web/deploy/
copyPath=/opt/app/jenkins/tmp
warName=falcon-controller.war
warFile=falcon-controller
#shutdown
cd $serverBin
ps -ef | grep -v grep | grep falconServer-web | awk '{print $2}' | xargs kill -9
#delete
rm -rf $deployPath$warName
rm -rf $deployPath$warFile
rm -rf $serverTemp
mkdir $serverTemp
rm -rf $serverWork
mkdir $serverWork
#copy
cp $copyPath/$warName $deployPath
export JAVA_HOME=/opt/app/jdk/jdk1.6.0_31
export CLASSPATH=$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
#run
cd $serverBin
nohup ./startfalconServer-web.sh &
#判断是否可访问
STATUS_CODE=0
echo $STATUS_CODE
while [[ $STATUS_CODE != 200 ]]
do
STATUS_CODE=`curl -o /dev/null -s -w %{http_code} http://172.22.12.224:8380/falcon-controller/test.html`
done
7、立即构建(即为启动配置)
1、在 构建历史Build History中找到历史,点击右侧向下小箭头,点击Console Output 即可看到编译的日志
2、前面圆形图片为蓝色,即构建成功
版权声明
本文为[会开车的架构师]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4629483/blog/4529707
边栏推荐
- hdu3974 Assign the task線段樹 dfs序
- 【ElasticSearch搜索引擎】
- 2020年第四届中国 BIM (数字建造)经理高峰论坛即将在杭举办
- ES6 learning notes (5): easy to understand ES6's built-in extension objects
- 小游戏云开发入门
- 【字节跳动 秋招岗位开放啦】Ohayoo!放学别走,我想约你做游戏!!!
- CCR coin frying robot: the boss of bitcoin digital currency, what you have to know
- python100例項
- The importance of big data application is reflected in all aspects
- Jmeter——ForEach Controller&Loop Controller
猜你喜欢
2020年第四届中国 BIM (数字建造)经理高峰论坛即将在杭举办
MongoDB与SQL常用语法对应表
What are Devops
新建一个空文件占用多少磁盘空间?
PHP application docking justswap special development kit【 JustSwap.PHP ]
What are the common problems of DTU connection
StickEngine-架构12-通信协议
Ronglian completed US $125 million f round financing
Take you to learn the new methods in Es5
To teach you to easily understand the basic usage of Vue codemirror: mainly to achieve code editing, verification prompt, code formatting
随机推荐
PHP application docking justswap special development kit【 JustSwap.PHP ]
IPFs rudder filecoin landing at the same time, fil currency price broke a thousand
html+vue.js 實現分頁可相容IE
一路踩坑,被迫聊聊 C# 代码调试技巧和远程调试
前端未來趨勢之原生API:Web Components
Share with Lianyun: is IPFs / filecoin worth investing in?
Live broadcast preview | micro service architecture Learning Series live broadcast phase 3
image operating system windows cannot be used on this platform
游戏开发中的新手引导与事件管理系统
For a while, a dynamic thread pool was created, and the source code was put into GitHub
How to hide part of barcode text in barcode generation software
The legality of IPFs / filecoin: protecting personal privacy from disclosure
CCR coin frying robot: the boss of bitcoin digital currency, what you have to know
Digital city responds to relevant national policies and vigorously develops the construction of digital twin platform
Humor: hacker programming is actually similar to machine learning!
小游戏云开发入门
C語言I部落格作業03
Introduction to X Window System
【應用程式見解 Application Insights】Application Insights 使用 Application Maps 構建請求鏈路檢視
StickEngine-架构12-通信协议