Jenkins 是一个开源项目,提供了一种易于使用的持续集成系统,使开发者从繁杂的集成中解脱出来,专注于更为重要的业务逻辑实现上。同时 Jenkins 能实施监控集成中存在的错误,提供详细的日志文件和提醒功能,还能用图表的形式形象地展示项目构建的趋势和稳定性。
Mac OS 10.11.4
Jenkins 1.651.1
tomcat 8
jdk 8
软件准备
下载tomcat
wget http://apache.mirrors.ionfish.org/tomcat/tomcat-8/v8.0.33/bin/apache-tomcat-8.0.33.zip
解压tomcat
unaip apache-tomcat-8.0.33.zip mv apache-tomcat-8.0.33 tomcat_jenkins
安装JDK
直接去官网下载pkg,安装就可以了.这里不写详细的教程了
安装
Jenkins
下载
Jenkins
,去官网Jenkins
这里直接下载war
包, 不要下载Mac OS X
,下载完成的到jenkins.war
文件
安装,启动 Jenkins
准备
jenkins
的tomcat
将
jenkins.war
文件复制到jenkins/tomcat_jenkins/webapps
,然后删除ROOT
文件, 重命名jenkins.war -> ROOT.war
mv jenkins.war jenkins/tomcat_jenkins/webapps/ rm -rf ROOT/ mv jenkins.war ROOT.war
配置环境变量
在 jenkins/tomcat_jenkins/bin 目录下新建 setenv.sh 文件,内容如下:
export JENKINS_HOME=/Users/songlijun/Work/Dev/jenkins
启动tomcat
cd jenkins/tomcat_jenkins/bin sh ./startup.sh
可能会出现如下错误, 是因为没有设置权限.
Cannot find ./catalina.sh The file is absent or does not have execute permission This file is needed to run this program
解决方法,执行如下命令,然后在启动
chmod 777 *.sh sh ./startup.sh
正确启动
Using CATALINA_BASE: /Users/songlijun/Work/Dev/jenkins/tomcat_jenkins Using CATALINA_HOME: /Users/songlijun/Work/Dev/jenkins/tomcat_jenkins Using CATALINA_TMPDIR: /Users/songlijun/Work/Dev/jenkins/tomcat_jenkins/temp Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home Using CLASSPATH: /Users/songlijun/Work/Dev/jenkins/tomcat_jenkins/bin/bootstrap.jar:/Users/songlijun/Work/Dev/jenkins/tomcat_jenkins/bin/tomcat-juli.jar Tomcat started.
正常启动日志如下
tail -f ../logs/catalina.out 29-Apr-2016 17:43:58.322 INFO [pool-14-thread-11] jenkins.InitReactorRunner$1.onAttained Started all plugins 29-Apr-2016 17:43:58.323 INFO [pool-14-thread-14] jenkins.InitReactorRunner$1.onAttained Augmented all extensions 29-Apr-2016 17:43:58.323 INFO [pool-14-thread-16] jenkins.InitReactorRunner$1.onAttained Loaded all jobs 29-Apr-2016 17:43:58.323 INFO [pool-14-thread-4] jenkins.InitReactorRunner$1.onAttained Completed initialization 29-Apr-2016 17:43:58.325 INFO [Jenkins initialization thread] hudson.WebAppMain$3.run Jenkins is fully up and running 29-Apr-2016 17:44:21.599 INFO [Download metadata thread] hudson.model.UpdateSite.updateData Obtained the latest update center data file for UpdateSource default 29-Apr-2016 17:44:24.009 INFO [Download metadata thread] hudson.model.DownloadService$Downloadable.load Obtained the updated data file for hudson.tasks.Maven.MavenInstaller 29-Apr-2016 17:44:24.552 INFO [Download metadata thread] hudson.model.DownloadService$Downloadable.load Obtained the updated data file for hudson.tasks.Ant.AntInstaller 29-Apr-2016 17:44:28.070 INFO [Download metadata thread] hudson.model.DownloadService$Downloadable.load Obtained the updated data file for hudson.tools.JDKInstaller 29-Apr-2016 17:44:28.073 INFO [Download metadata thread] hudson.model.AsyncPeriodicWork$1.run Finished Download metadata. 30,304 ms
打开
Jenkins
浏览器输入
http://127.0.0.1:8080/
🍻, 恭喜你
Jenkins
安装成功了.
###总结
尝试pkg
安装不成功,因为Jenkins
就是java
的项目,可以直接在tomcat应用服务器下面运行启动,这样就比较方便了.大家可以用Jenkins
配合Github
打包了
参考链接
[Linux Centos安装Jenkins](Linux Centos安装Jenkins)