Skip to content

Instantly share code, notes, and snippets.

@Hansimov
Last active June 29, 2021 05:13
Show Gist options
  • Save Hansimov/7c5fda3ed30f48d9ec5488005df6e098 to your computer and use it in GitHub Desktop.
Save Hansimov/7c5fda3ed30f48d9ec5488005df6e098 to your computer and use it in GitHub Desktop.

Download and run jenkins.war

References:

(1) Download jenkins.war with command line:

  • remember to change the version, which can get from the second link above
wget wget https://updates.jenkins-ci.org/download/war/<version>/jenkins.war --no-check-certificate

(2) Set JENKINS_HOME in the OS environment variables

Append the line below in .cshrc (if using csh):

  • $ws is your working diretory
  • JENKINS_HOME is root directory of Jenkins, which can be seen when Jenkins starts up.
  • $jk is the alias of $JENKINS_HOME in this article from here on
setenv jk $ws/ci/jk
setenv JENKINS_HOME $jk

(3) Run jenkins.war with Java 8/11, use --httpPort=<Port> to specify a port number (default is 8080):

  • You can use java -version to check the Java version.
java -jar jenkins.jar --httpPort=8088

(4) Open http://<your_ip_or_domain>:8088 in your web browser and configure Jenkins

Configure Jenkins

Refererences:

(1) Unlock Jenkins. Use following command to get the admin password:

cat $jk/secrets/initialAdminPassword

which will output a 32-char string: ed8dxxxxxxxxxxxxxxxxxxxxxxxx52aa, copy and paster to the input box, and "Continue".

(2) Set HTTP Proxy with Server and Port

If the proxy given to you is a domain name, like http://proxy-xxx.yyy.com:<Port>, then you need to convert it to pure ip.

Type the following command:

dig +short <domain_name>

which will output an IP like 10.1.192.48, then use this IP as your Server in the Jenkins HTTP Proxy Configuration.

You can further click the Advanced and validate the proxy with http://www.google.com. If the proxy is valid, then it will display Success. If not, It will show Error and you need to check it.

Most problems are caused by configuring the proxy incorrectly. Check whether the Server (must use pure IP) and Port is correct.

(3) Then it will automatically install suggested plugins for you. Just wait few minutes until it is finished.

(4) Add a new user (may encounter 403 problem, see below), or just skip and login as admin (use cat $jk/secrets/initialAdminPassword to get the password).

Setup agent and cloud

To be written ...

Common problems

403: No valid crumb was included in the request

Go to Dashboard > Configure Global Security (http://<jenkins>:8088/configureSecurity/) > CSRF Protection > Crumb Issuer > Default Crumb Issuer, and check "Enable proxy compatibility".

References:

  • Jenkins -> 403 No valid crumb was included in the request · Issue #2067 · spinnaker/spinnaker

Other links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment