When installing Jenkins, I found that the plug-in could not be installed, and I replaced the domestic source according to the online tutorial. However, when downloading Jenkins, I checked the log and found that I went to jenkins. IO to download the plug-in again, indicating that the new domestic source did not take effect

Finally, I found a perfect method as follows:

Run using jar packages

Nohup Java - Dhudson. Model. DownloadService. NoSignatureCheck = true - jar Jenkins. War - httpPort = {you want to set a port} &Copy the code

Here use nohup let Java program running in the background, be sure to add – Dhudson. Model. DownloadService. NoSignatureCheck = true, this is close to check, I just didn’t add this, lead to modify the also didn’t take effect

  • To modify/root /. Hudson/Jenkins. Model. UpdateCenter. XML, the source address is replaced by:

Mirror.tuna.tsinghua.edu.cn/jenkins/upd… Better not add the s, because I didn’t add it

<? The XML version = '1.1' encoding = "utf-8"? > <sites> <site> <id>default</id> <url>http://mirror.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json</url> </site>Copy the code

2. Modify the configuration file

  • The updates folder does not exist in the Jenkins directory. I guess this directory will be generated when I install the plugin for the first time, so LET’s leave it at that.

  • After logging in to Jenkins for the first time (the way to obtain the password has been clearly suggested by Jenkins, there is not much BB here), click Continue and enter the page of plug-in installation. Generally, you will be reminded that you are offline, thinking that you modified the configuration file after war was started, so at this time, Go to http://ip:port/restart and add /restart to Jenkins’ URL. After you restart the Jenkins url, your configuration changes will take effect and you will not be told that you are offline. The /root/.Jenkins /updates folder finally appeared

Modify default.json

To/root /. Jenkins/default. Jenkins updated directory of json is modified to domestic source directory, and change detection address from Google to baidu

sed -i 's/https:\/\/updates.jenkins.io\/download/http:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' /root/.jenkins/updates/default.json && sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' /root/.jenkins/updates/default.json
Copy the code

Reboot Jenkins again. Go to /restart, restart, start to install plug-ins, experience flying speed, hahaha