1,安裝java
centos下:ubuntu
yum install jenkins
若是沒有jenkins庫 須要先添加庫centos
$ wget -O /etc/yum.repos.d/jenkins.repo http://jenkins-ci.org/redhat/jenkins.repo $ rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
2,啓動bash
jenkins安裝好之後less
service jenkins start
查看jenkins啓動狀態ui
service jenkins status
若是沒有啓動多是端口占用,jenkins默認的啓動端口爲8080code
修改啓動端口:ip
jenkins的war包存放在/usr/lib/jenkins目錄下,配置文件jenkins在/etc/sysconfig有個jenkins文件,修改端口爲8888ci
ubuntu上該文件在 /etc/default/jenkinsget
## Type: integer(0:65535) ## Default: 8080 ## ServiceRestart: jenkins # # Port Jenkins is listening on. # Set to -1 to disable # JENKINS_PORT="8888"
能夠看到jenkins的主目錄
## Path: Development/Jenkins ## Description: Jenkins Continuous Integration Server ## Type: string ## Default: "/var/lib/jenkins" ## ServiceRestart: jenkins # # Directory where Jenkins store its configuration and working # files (checkouts, build reports, artifacts, ...). # JENKINS_HOME="/var/lib/jenkins"
建議修改一處配置增長一個參數
-Dhudson.util.ProcessTree.disable=true
之後會用到:
## Type: string ## Default: "-Djava.awt.headless=true" ## ServiceRestart: jenkins # # Options to pass to java when running Jenkins. # JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.util.P rocessTree.disable=true"
3,修改密碼:
啓動成功之後訪問:
192.168.1.90:8888
進入密碼登錄頁面:第一次進入,隨機密碼在配置文件中
/var/lib/jenkins/secrets/initialAdminPassword