解压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
- 启动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)
网友评论