安装
WIKI:https://wiki.jenkins.io/display/JENKINS/Installing+Jenkins+on+Red+Hat+distributions
安装包下载:https://pkg.jenkins.io/redhat-stable/
Installation of a stable version
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
rpm –import https://jenkins-ci.org/redhat/jenkins-ci.org.key
yum install jenkins
启动服务
systemctl start jenkins
开机启动
chkconfig jenkins on
administration 初始密码位置
/var/lib/jenkins/secrets/initialAdminPassword
修改配置
修改端口
vim /etc/sysconfig/jenkins
## Type: integer(0:65535)
## Default: 8080
## ServiceRestart: jenkins
#
# Port Jenkins is listening on.
# Set to -1 to disable
#
JENKINS_PORT="8899"
修改为自己想用的端口号,如果开启了防火墙记得开放8899端口。
生成ssh-key
将false改为bash,否则无法切换到jenkins账户,ssh-keygen就无法生成jenkins用户的密钥了
vim /etc/passwd
jenkins:x:996:994:Jenkins Continuous Integration Server:/var/lib/jenkins:/bin/false ->bash
ssh-keygen -t rsa -C "key desc"
ssh-add ~/.ssh/id_rsa
`Could not open a connection to your authentication agent.`
eval `ssh-agent`
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub
将生成的公钥添加到gerrit创建的jenkins账户中。
plugin安装
Gerrit Trigger
https://wiki.jenkins.io/display/JENKINS/Gerrit+TriggerMaven Integration plugin
Deploy to container Plugin
常见问题
- 页面跳转会出现no find的情况
可以检查一下系统配置里面jenkins URL是否是正确的
Manage Jenkins->Configure System->Jenkins Location->Jenkins URL–>http://39.108.165.220:8899/