本文摘抄自:https://www.cnblogs.com/edward2013/p/5284503.html ,請支持原版!html
1. 安裝JDK
1
|
yum -y
install
java
|
2.安裝Ant
添加JPackage源java
1
2
|
yum -y
install
wget
wget http:
//www
.jpackage.org
/jpackage50
.repo -P
/etc/yum
.repos.d/
|
安裝Antweb
1
|
yum -y
install
ant
|
3.安裝Maven
1
|
yum -y
install
maven
|
4.安裝Tomcat
1
|
yum -y
install
tomcat
|
設置tomcat編碼爲UTF-8tomcat
# vi /etc/tomcat/server.xmlbash
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />
5.安裝Jenkins
方法1:
下載jenkins.war到webapps目錄下app
wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war -P /var/lib/tomcat/webapps/
設置tomcat自啓動,並啓動tomcatwebapp
chkconfig tomcat on service tomcat start
訪問Jenkins主頁 http://localhost:8080/jenkinsmaven
方法2:
1
2
3
|
sudo
wget -O
/etc/yum
.repos.d
/jenkins
.repo http:
//pkg
.jenkins-ci.org
/redhat-stable/jenkins
.repo
sudo
rpm --
import
http:
//pkg
.jenkins-ci.org
/redhat-stable/jenkins-ci
.org.key
yum
install
jenkins
|
設置jenkins自啓動,並啓動jenkins編碼
1
2
|
chkconfig jenkins on
service jenkins start
|
jenkins默認端口是8080,若是端口已被別的程序佔用,可在jenkins配置文件/etc/sysconfig/jenkins中修改jenkins端口號spa
1
|
JENKINS_PORT=
"8001"
|
若是還安裝有tomcat程序,還需修改AJP端口號
1
|
JENKINS_AJP_PORT=
"8010"
|
訪問Jenkins主頁 http://localhost:8001
5.JDK、Maven、Ant配置
6.插件管理
Jenkins可以集成各式插件,如經常使用CI插件:deploy,junit,findbugs,pmd,checkstyle,clover, duplicate code,jmeter,selenium等
點擊 「系統管理」 -> 「管理插件」
點擊 「可選插件」,選擇須要的插件
而後點擊 「直接安裝」
jenkins的目錄結構:
/usr/lib/jenkins/jenkins.war WAR包 /etc/sysconfig/jenkins 配置文件 /var/lib/jenkins/ 默認的JENKINS_HOME目錄 /var/log/jenkins/jenkins.log Jenkins日誌文件 |