Blog.csdn.net/qq_32706349…

Download address: www.jenkins.org.cn/d, this is the Chinese download address, fast

Put Jenkins package under Tomcat project directory Webapps:Access it in a browserhttp://IP:8080/jenkins gets the following figure According to the prompt, in the cat/root /. Jenkins/secrets/initialAdminPassword obtained after a string of characters, the input to the following the administrator password box, to the next page

At this point, don’t do anything. FirstIn the sourceJson file. The default.json file is in /root/.jenkins/updates

In the source

There are three ways to switch sources:

The first way: use Vim

  • Method: Modify the default.json downloaded from the official address after Jenkins started by Vim. The modification can only be carried out after the downloading of default.json is completed
$ cd ${JENKINS_HOME}/updates  Enter the update configuration location
$ vim default.json   This Json file is the same as the configuration file above
Copy the code

This configuration can be successfully modified without changing the wiki and Github documentation

Use vim’s command, as follows, to replace all urls downloaded by plug-ins

:1.$s/http:\/\/updates.jenkins-ci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g
Copy the code

Replace the connection test URL

:1.$s/http:\/\/www.google.com/https:\/\/www.baidu.com/g
Copy the code

Enter vim first type: and then paste the command above: after, be careful not to write two colons!

Second way: use sed

  • Method: Use sed command to modify the default.json downloaded from the official address after Jenkins started. It can only be modified after the downloading of default.json is completed
$ cd ${JENKINS_HOME}/updates  Enter the update configuration location
$ 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
Copy the code

This is a direct modification of the configuration file, if Jenkins used sudo to boot, then the two seDs here need to be preceded by sudo

Third method: Download a copy of update-center.json, manually modify it, and store it on the local Web server

  • How to: Prepare updated update-center.json in advance to replace default.json without waiting for official default.json download
cd $JENKINS_HOME
curl -Lo update-center.json https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
sed -i 's#http://updates.jenkins-ci.org/download#https://mirrors.tuna.tsinghua.edu.cn/jenkins#g' update-center.json && sed -i 's#http://www.google.com#https://www.baidu.com#g' update-center.json
# to install Nginx
sudo apt install nginx -y
# Move configuration to nginx default Web directory
sudo mv update-center.json /var/www/html/
# Modify the Jenkins configuration file
sed -i "S # http:// local Nginx - IP/update - center. Json# https://updates.jenkins.io/update-center.json#g" hudson.model.UpdateCenter.xml
Copy the code

Reboot Jenkins and try installing the plugin. It’s overspeed!! Type the link below in your browser to restart

http://IP:8080/jenkins/restart
Copy the code

Select Select plug-ins to install, select the required plug-ins, and proceed to the next stepInstall the plug-in.Use the admin account directlyFor example configuration, enter this address:http://IP:8080/jenkins/

Finally, the Jenkins page is displayed

The reverse proxy is incorrectly configured

First check whether Jenkins URL is configured correctly

  • There is a problem with deploying Jenkins on Tomcat. You can click “No longer show” and it will not have any impact
  • You can also run Jenkins with java-jar instead and you won’t have this problem

Global Tool Configuration

Configure Maven and JDK, not for other languages