编程知识 cdmana.com

Installing Jenkins 2.222.4 in Linux

Environmental Science
operating system :ubuntu16.04
Software version :jenkins-2.222.4
 
step
 
Official website
https://www.jenkins.io/zh/download/
#  Using document 
https://www.jenkins.io/zh/doc/pipeline/tour/getting-started/

download

#  notes : download war package , It's the easiest way to install ,war Package built in jetty service , It can be run directly from the command line 
wget http://mirror.serverion.com/jenkins/war-stable/2.222.4/jenkins.war

rely on

Jdk:1.8

Create directory

cd /opt
mkdir -p jenkins

Moving files

mv jenkins.war /opt/jenkins

Run the command line

#  Default run 
/opt/jdk1.8.0_51/bin/java -jar jenkins.war
#  Specify the operation port 
/opt/jdk1.8.0_51/bin/java -jar jenkins.war --httpPort=8088
#  Specify the run port and URL Prefix 
/opt/jdk1.8.0_51/bin/java -jar jenkins.war --httpPort=8088 --prefix=/jenkins/
 Be careful : For the first time , Will initialize the build directory to the default $user.home/.jenkins , If it is currently root user , be :Jenkins home directory: /root/.jenkins, The startup log will print 
#  Background operation 
/opt/jdk1.8.0_51/bin/java -jar jenkins.war --httpPort=8088 --prefix=/jenkins/ > log.out 2>&1 &
#  close CSRF The protection work runs 
/opt/jdk1.8.0_51/bin/java -Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=true -jar jenkins.war --httpPort=8088 --prefix=/jenkins/
# Jenkins Version from 2.204.6 The major changes since are : Delete disable  CSRF  The function of protection .
# Is not enabled CSRF Protection function , Be sure to add it to -jar Before , Otherwise there is a mistake 
-Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=true

View run help

java -jar jenkins.war --help

visit

http://192.168.1.3:8088

View callable api

http://192.168.1.3/jenkins/api/json

see crubm data value

http://192.168.1.3/jenkins/crumbIssuer/api/xml?tree=crumb#

or

curl -s 'http://rise_jenkins_admin:1234567890@192.168.1.3/jenkins/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)'

or

http://rise_jenkins_admin:123456789@192.168.1.3/jenkins/crumbIssuer/api/json

 

Nginx + Jenkins Forwarding configuration
#nginx.conf To configure , For internal unified reverse proxy ( On demand configuration )
location ^~/jenkins {
   proxy_pass http://192.168.1.3:8088/jenkins;
   proxy_set_header Host $host;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_set_header HTTP_X_FORWARDED_FOR $remote_addr;
   proxy_redirect default;
}
#  Specify the run port and URL Prefix 
/opt/jdk1.8.0_51/bin/java -jar jenkins.war --httpPort=8088 --prefix=/jenkins/

Remote execution build trigger ( Need to configure “ Build trigger ”)

curl -X post -v -u rise_jenkins_admin:1234567890 http://192.168.1.3:8088/jenkins/job/test-project/build?token=token_123456

 

matters needing attention

1. First boot , Will initialize the installation Jenkins, The following will be printed in the log :
*************************************************************
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:
xx90889ddxxxxxxxxxxxxxxxxxxxxx
This may also be found at: /root/.jenkins/secrets/initialAdminPassword
*************************************************************
The administrator authentication password will be generated , Please record the string , You need to fill in , After successful installation , The follow-up logs will not be printed ;
 
Required plug-ins :
Language pack dependency plug-ins :Locale plugin
Chinese language pack plug-in :Localization: Chinese (Simplified)
Matrix based security plug-in :Matrix Authorization Strategy
Based on the matrix project security plug-in :Authorize Project
Maven Management plug-in :Maven Integration
SVN plug-in unit :Subversion
Automatic release war Package plugin :Deploy to container
SSH Protocol execution remote shell:SSH Plugin
Access control management plug-in :Role-based Authorization Strategy
 
problem
error :
Plug in management page prompt :
There were errors checking the update sites:IOException:Unable to tunnel through proxy.Proxy returins "HTTP/1.1 400"

or

Plug in management page prompt :
There were errors checking the update sites: SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed

Treatment scheme :

Enter plug-in management ->Advanced, modify Update Site Of URL, Path is “http://updates.jenkins.io/update-center.json”, That is to say, by default https Switch to http, Modified to complete ,submit, then checknow, I.e. solution .
 
error :
org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: The username you provided is not allowed to use the text-based Tomcat Manager (error 403)

Treatment scheme : stay /etc/tomcat7/tomcat-users.xml Add... To the file for administrative users manager-script A character can .

 
error :
org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: The username and password you provided are not correct (error 401)

Treatment scheme : stay /etc/tomcat7/tomcat-users.xml Add... To the file for administrative users manager-status A character can .

 
error :
Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: The Tomcat Manager responded "FAIL - Deployed application at context path /CloudPayment but context failed to start " instead of the expected "OK" message

Treatment scheme : project war Package startup error , Need to be excluded war Package problem ;

 
error :
HTTP ERROR 403 No valid crumb was included in the request

Treatment scheme : The old version Jenkins Of CSRF The protection function only needs to be in System management > Global security configuration You can open or close .Jenkins Version from 2.204.6 The major changes since are : Delete disable CSRF The function of protection . stay tomcat Start configuration or jar Add the following configuration parameters before running the package , Ban CSRF Protection function ;

-Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=true

 

版权声明
本文为[Little dragon man who can't fly]所创,转载请带上原文链接,感谢
https://cdmana.com/2020/12/20201224103832264B.html

Scroll to Top