First come an error message, which is really hard to pull. .
1. First solve the first problem, change the plug-in download address to a domestic source
Official source: https://updates.jenkins.io/update-center.json
Domestic source: https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/current/update-center.json
Domestic source 2: http://mirror.xmission.com/jenkins/updates/update-center.json
Modify the configuration file
- Enter /updates/default.json in the jenkins installation directory, and replace updates.jenkins-ci.org/download with mirrors.tuna.tsinghua.edu.cn/jenkins,
- In some jenkins versions, updates.jenkins.io/download is replaced by mirrors.tuna.tsinghua.edu.cn/jenkins
- Then, change www.google.com to www.baidu.com
sed -i 's#http://updates.jenkins-ci.org/download#https://mirrors.tuna.tsinghua.edu.cn/jenkins#g' default.json
sed -i 's#http://www.google.com#https://www.baidu.com#g' default.json
restart jenkins
2. In the process of solving the plug-in installation problem, I found that my jenkins version was too low, resulting in incompatibility of some installed plug-ins or plug-ins that the installed plug-ins depend on, so the second problem is to upgrade jenkins
Here I installed jenkins with docker. You can read my previous article for installation, so you must first enter the jenkins container
# 进到jenkins.war文件所在的目录
root@456fcdc45cdf:/var/jenkins_home# cd /usr/share/jenkins/
root@456fcdc45cdf:/usr/share/jenkins# ls
jenkins.war ref
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins#
# 备份原war包
root@456fcdc45cdf:/usr/share/jenkins# cp jenkins.war jenkins.war.2.328.bak
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins# ls
jenkins.war jenkins.war.2.328.bak ref
# 新建文件夹,存储新的war包
root@456fcdc45cdf:/usr/share/jenkins# mkdir other-version
root@456fcdc45cdf:/usr/share/jenkins# cd other-version/
# 下载最新的war包
root@456fcdc45cdf:/usr/share/jenkins/other-version# wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war
root@456fcdc45cdf:/usr/share/jenkins# ls
jenkins.war jenkins.war.2.328.bak other-version ref
# 删除原war包
root@456fcdc45cdf:/usr/share/jenkins# rm jenkins.war
root@456fcdc45cdf:/usr/share/jenkins# ls
jenkins.war.2.328.bak other-version ref
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins# cd other-version/
# 替换war包
root@456fcdc45cdf:/usr/share/jenkins/other-version# mv jenkins.war ../
root@456fcdc45cdf:/usr/share/jenkins/other-version#
root@456fcdc45cdf:/usr/share/jenkins/other-version#
root@456fcdc45cdf:/usr/share/jenkins/other-version# ls
root@456fcdc45cdf:/usr/share/jenkins/other-version# cd ..
root@456fcdc45cdf:/usr/share/jenkins# ls
jenkins.war jenkins.war.2.328.bak other-version ref
root@456fcdc45cdf:/usr/share/jenkins#
# 退出容器
root@456fcdc45cdf:/usr/share/jenkins# exit
[root@qa work]#
# 重启
[root@qa work]# docker restart jenkins
jenkins
Jenkins download official website: https://www.jenkins.io/download/
Download the latest version Link: http://mirrors.jenkins.io/war-stable/latest/jenkins.war
All war package addresses: https:// mirrors.tuna.tsinghua.edu.cn/jenkins/war/
3. After replacing the jenkins.war file, the docker image file cannot start the solution
777 docker ps -a
778 docker cp 456f:/usr/share/jenkins/jenkins.war ./
779 ll
780 docker cp 456f:/usr/share/jenkins/jenkins.war.2.328.bak ./
781 ll
782 rm -rf jenkins.war
783 mv jenkins.war.2.328.bak jenkins.war
784 docker cp ./jenkins.war 456f:/usr/share/jenkins/jenkins.war
785 docker start 456f
786 docker ps
795 ll
796 docker ps
797 docekr logs -f 456f
798 docker logs -f 456f
799 ll
800 mv jenkins.war jenkins.war.2.328.bak
801 docker exec -it 456f bash
802 docker exec -it 456f -u root /bin/bash
803 docker exec -it jenkins -u root /bin/bash
804 rz
805 docker ps
806 docker cp ./jenkins.war 456f:usr/share/jenkins
807 docker restart 456f
808 docekr ps
809 docker ps
810 docker logs -f 456f
811 history
Screenshot after repairing the problem
Note: Due to the replacement of the war file, both the ssh credentials and the java-web file need to be replaced, just restart after replacement