网上找了很多都解决不了问题,直到看到jenkins-update-center
建议系统方式安装jenkins,除非你想踩踩docker版本的坑
系统直装
- 系统中已完成jenkins安装
- 如果在jenkins中需要使用docker,在宿主机上装完docker后,记得添加一下用户组:
gpasswd -a jenkins docker;newgrp docker
-下载证书文件
[ ! -d /var/lib/jenkins/update-center-rootCAs ] && mkdir /var/lib/jenkins/update-center-rootCAs
wget https://cdn.jsdelivr.net/gh/lework/jenkins-update-center/rootCA/update-center.crt -O /var/lib/jenkins/update-center-rootCAs/update-center.crt
chown jenkins.jenkins -R /var/lib/jenkins/update-center-rootCAs
- 修改源
sed -i 's#https://updates.jenkins.io/update-center.json#https://cdn.jsdelivr.net/gh/lework/jenkins-update-center/updates/tsinghua/update-center.json#' /var/lib/jenkins/hudson.model.UpdateCenter.xml
rm -f /var/lib/jenkins/updates/default.json
systemctl restart jenkins
systemctl restart jenkins
- 查看密码
cat /var/lib/jenkins/secrets/initialAdminPassword
Docker
1、
docker run -itd
--env JAVA_OPTS=-Dhudson.model.DownloadService.noSignatureCheck=true
--name jekins
-v jenkins_home:/var/jenkins_home
-p 8080:8080 -p 50000:50000
jenkins/jenkins:lts-jdk11
2、等待Web可以访问到jekins,再执行下面命令,替换为国内源,否则会报文件不存在
docker exec jekins sed -i 's#https://updates.jenkins.io/update-center.json#https://cdn.jsdelivr.net/gh/lework/jenkins-update-center/updates/tsinghua/update-center.json#' /var/jenkins_home/hudson.model.UpdateCenter.xml
3、重启
docker restart jekins
4、查看initialAdminPassword
docker logs -f jekins
插件下载的飞起,爽歪歪~