1 安装git 1.8.3.1
yum install git
2 安装jekins
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum install jenkins
3 配置监听端口
vim /etc/sysconfig/jenkins
#监听端口
JENKINS_PORT=“4040”
4 配置权限
vim /etc/sysconfig/jenkins
$JENKINS_USER=“root”
chown -R root:root /var/lib/jenkins
chown -R root:root /var/cache/jenkins
chown -R root:root /var/log/jenkins
5启动
service jenkins restart
ps -ef | grep jenkins
systemctl start jenkins
其他
复制密码
cat /var/lib/jenkins/secrets/initialAdminPassword
第一次登录jenkins需要使用初始密码登录系统
关闭centos防火墙
systemctl stop firewalld.service
关闭防火墙自启动
systemctl disable firewalld.service
不采用jenkins镜像而采取安装宿主机的原因
1 docker启动jenkins镜像 jenkins每次都要重新安装
(当然可以数据卷功能,将jenkins容器生成的数据挂载到宿主机,保证容器无状态)
2 docker容器之间交互不方便,不便于jenkins与gitlab、nexus、registry交互
参考博文:https://www.cnblogs.com/stulzq/p/9291237.html