一、Jenkins簡介
Jenkins 是一個開源項目,提供了一種易於使用的持續集成系統,使開發者從繁雜的集成中解脫出來,專注於更爲重要的業務邏輯實現上。同時 Jenkins 能實施監控集成中存在的錯誤,提供詳細的日誌文件和提醒功能,還能用圖表的形式形象地展示項目構建的趨勢和穩定性。
Jenkins可以做到持續編譯和發佈軟件項目,這使得開發者很容易把他們的改動集成到項目中,還讓用戶能更加便利的獲取編譯和測試版本;
二、java環境下載安裝
2.1 進入opt目錄並下載jre
[root@ces33 ~]# cd /opt [root@ces33 opt]# wget -O jre-8u101-linux-x64.tar.gz " http://sdlc-esd.oracle.com/ESD6/JSCDL/jdk/8u101-b13/jre-8u101-linux-x64.tar.gz?GroupName=JSC&FilePath=/ESD6/JSCDL/jdk/8u101-b13/jre-8u101-linux-x64.tar.gz&BHost=javadl.sun.com&File=jre-8u101-linux-x64.tar.gz&AuthParam=1472441383_f4bf6efe030eac7fa583ef003168c2e6&ext=.gz"
2.2 解壓jre 並進入jre文件安裝
[root@ces33 opt]# tar xvf jre-8u101-linux-x64.tar.gz [root@ces33 opt]# ls /opt jre1.8.0_101 jre-8u101-linux-x64.tar.gz [root@ces33 opt]#cd jre1.8.0_101 / [root@ces33 jre1.8.0_101]#alternatives --install /usr/bin/java java /opt/jre1.8.0_101/bin/java 1 [root@ces33 jre1.8.0_101]# alternatives --config java There is 1 program that provides 'java'. Selection Command ----------------------------------------------- *+ 1 /opt/jre1.8.0_101/bin/java Enter to keep the current selection[+], or type selection number: 1
三、安裝jenkins
3.1下載並安裝
[root@ces33 opt]#wget http://mirrors.jenkins-ci.org/redhat-stable/jenkins-2.7.2-1.1.noarch.rpm [root@ces33 opt]# rpm -ivh jenkins-2.7.2-1.1.noarch.rpm warning: jenkins-2.7.2-1.1.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID d50582e6: NOKEY Preparing... ########################################### [100%] 1:jenkins ########################################### [100%]
[root@ces33 ~]# chkconfig --list jenkins jenkins 0:off 1:off 2:off 3:on 4:off 5:on 6:off [root@ces33 ~]# /etc/init.d/jenkins start Starting Jenkins [ OK ] [root@ces33 ~]# ps -ef |grep jenkins jenkins 4275 1 99 11:41 ? 00:00:43 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --daemon --httpPort=8080 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20 root 4363 3666 0 11:42 pts/0 00:00:00 grep jenkins [root@ces33 ~]# netstat -ntlup |grep java tcp 0 0 :::8080 :::* LISTEN 4275/java tcp 0 0 :::37589 :::* LISTEN 4275/java udp 0 0 :::5353 :::* 4275/java udp 0 0 :::33848 :::* 4275/java
3.2防火牆開放8080端口
[root@ces33 ~]# iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
3.3WEB界面安裝
打開瀏覽器輸入http://ipaddress of server:8080進入WEB安裝界面
複製/var/lib/jenkins/secrets/initialAdminPassword文件內容並粘貼
[root@ces33 ~]# cat /var/lib/jenkins/secrets/initialAdminPassword 425e6a44319e4c8fb909a73b02d1b55c
選擇安裝jenkins插件
插件類型選擇
插件安裝
配置密碼後登陸。
我們現在就可以訪問Jenkins,鏈接地址:http://ipaddress of server:8080 or http://localhost:8080
安裝完畢。