1. Jenkins’s brief introduction:

Jenkins. IO /doc/

2. The deployment:

2.1 the git deployment

Yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc GCC yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc GCC Perl -- ExtUtils MakeMaker 2.1.2 wget download git https://www.kernel.org/pub/software/scm/git/git-2.18.0.tar.xz 2.1.3 extract tar installation -vxf git-2.18.0.tar.xz -c /usr/local CD git-2.18.0 make prefix=/usr/local/git all make prefix=/usr/local/git install ln -s /usr/local/git/bin/git/bin/git 2.1.4 Verifying git --versionCopy the code

2.2 the maven deploy

Download maven 2.2.1 wget HTTP: / / http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz 2.2.2 Decompress tar -zvxf apache-maven-3.3.9-bin.tar.gz -c /usr/local 2.2.3 Configuring environment variable vi /etc/bashrc M2_HOME=/usr/local/maven/apache-maven-3.3.9 PATH=$PATH:$M2_HOME/bin export PATH M2_HOME 2.2.4 Environment variables take effect source /etc/bashrc 2.2.5 Verifying MVN-VCopy the code

2.3 Jenkins deployment

2.3.1 sudo wget -o/etc/yum repos. D/Jenkins. 'https://pkg.jenkins.io/redhat/jenkins.repoCopy the code

  2.3.2 sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
Copy the code

  2.3.3 yum install jenkins
Copy the code

The default Jenkins port number is 8080. The default Jenkins port number is 8086. The Jenkins configuration file is stored in /etc/sysconfig/jenkins vi /etc/sysconfig/jenkinsCopy the code

2.3.5 Start Script Change the JDK directory where the Jenkins start script is stored: vi /etc/rc.d/init.d/jenkinsCopy the code

2.3.6 Restarting the systemctl start Jenkins serviceCopy the code

2.3.7 Login IP Address: Port Number (http://jenkins.XXXX.com)Copy the code

2.3.8 unlock, perform the cat/var/lib/Jenkins/secrets/initialAdminPasswordCopy the code

2.3.9 Login succeeded and UsedCopy the code

3. Jenkins Global Tool configuration:

4. Problems encountered in the construction process:

4.1.Jenkins RestAPI call Error 403 No valid crumb was included in the request cause: Jenkins placed a toKN named. Crumb in the header of the HTTP request. If you use a reverse proxy and check the Prevent Cross Site Request Forgery Check box in Jenkins Settings, the token can be removed as an illegal header by the forwarding server Apache/Nginx. The jump fails. 1. Do not recommend putting Jenkins under Configure Global Security, disable prevent Cross-site request Forgery. 2. It is recommended to add red subscript server {ignore_invalid_headers = off; } 4.2. Jenkins reported that the reverse proxy setting was incorrect. Jenkins URL in System Management -> System Settings was changed to http://jenkins Intranet IP: portCopy the code