参考
http://pkg.jenkins-ci.org/redhat/
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
获取安装源
rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
导入公钥
yum install jenkins
安装Jenkins
按Y确认
gpasswd -a root jenkins
将jenkins账号加入到root组中
vim /etc/sysconfig/jenkins
修改端口号
默认端口号是8080
JENKINS_PORT="9090"
修改为root权限运行
JENKINS_USER="root"
vim /etc/init.d/jenkins
修改jenkins启动脚本
把/usr/bin/java
改为/usr/local/java/jdk1.8.0_201/bin/java
firewall-cmd --zone=public --permanent --add-port=9090/tcp
firewall-cmd --reload
开放防火墙9090端口
service jenkins start
chkconfig jenkins on
启动Jenkins
访问http://192.168.1.13:9090/
cat /var/lib/jenkins/secrets/initialAdminPassword
查看安装密码
service jenkins start/stop/restart
(启动/停止/重启)
rm -rf /etc/yum.repos.d/jenkins.repo
安装完成之后删除jenkins yum源