Show List

Jenkins Set Up

Jenkins is an open source automation server, used for building, deploying, and automating various tasks. Here's how you can install and set up Jenkins:

  1. Install Java: Jenkins is a Java application, so you need to have Java installed on your system before you can run Jenkins. You can check if Java is installed on your system by running the following command: java -version. If Java is not installed, you can download and install it from the official Java website.

  2. Download Jenkins: You can download the latest version of Jenkins from the official Jenkins website (https://jenkins.io/download/). After downloading, you can extract the archive to your desired location.

  3. Start Jenkins: To start Jenkins, open a terminal and navigate to the directory where you extracted Jenkins. Run the following command: java -jar jenkins.war. This will start the Jenkins server and it will be available at http://localhost:8080/.

  4. Complete the setup wizard: When you first access Jenkins, you will be prompted to complete a setup wizard. The wizard will guide you through the process of installing plugins, setting up authentication, and configuring system settings.

  5. Create your first job: After completing the setup wizard, you can create your first job in Jenkins. A job in Jenkins is a set of tasks that you want to automate. To create a job, click on the "New Item" link in the main menu and follow the steps to configure your job.

Demo

We are going to install Jenkins with Docker.

Start the Docker desktop and run below command from command line. This command also installs JDK on the container to run Jenkins.

docker run -p 8080:8080 -p 50000:50000 --restart=on-failure -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts-jdk11
C:\Users\mail2>docker run -p 8080:8080 -p 50000:50000 --restart=on-failure -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts-jdk11
Unable to find image 'jenkins/jenkins:lts-jdk11' locally
lts-jdk11: Pulling from jenkins/jenkins
23858da423a6: Pull complete
083a7909e360: Pull complete
1f0c7b37bbb8: Pull complete
3b408ac3463a: Pull complete
733c7d493b98: Pull complete
da321fc86b26: Pull complete
aa0ace980972: Pull complete
22b8ea32f0c2: Pull complete
3f461eced390: Pull complete
c923fa7a20b7: Pull complete
ef540761c0c9: Pull complete
1ef265c6f74a: Pull complete
f573788e8c02: Pull complete
b9232d90d3e8: Pull complete
Digest: sha256:2af6730eb9fac44c27bf00a3fa668e94ebf0300b5febfee23dfa76f8954ea483
Status: Downloaded newer image for jenkins/jenkins:lts-jdk11
Running from: /usr/share/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
2022-10-31 11:02:11.077+0000 [id=1]     INFO    winstone.Logger#logInternal: Beginning extraction from war file
2022-10-31 11:02:12.203+0000 [id=1]     WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2022-10-31 11:02:12.277+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: jetty-10.0.11; built: 2022-06-21T21:12:44.640Z; git: d988aa016e0bb2de6fba84c1659049c72eae3e32; jvm 11.0.16.1+1
2022-10-31 11:02:12.659+0000 [id=1]     INFO    o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2022-10-31 11:02:12.741+0000 [id=1]     INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: Session workerName=node0
2022-10-31 11:02:13.527+0000 [id=1]     INFO    hudson.WebAppMain#contextInitialized: Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
2022-10-31 11:02:13.763+0000 [id=1]     INFO    o.e.j.s.handler.ContextHandler#doStart: Started w.@4d8286c4{Jenkins v2.361.2,/,file:///var/jenkins_home/war/,AVAILABLE}{/var/jenkins_home/war}
2022-10-31 11:02:13.790+0000 [id=1]     INFO    o.e.j.server.AbstractConnector#doStart: Started ServerConnector@e84a8e1{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2022-10-31 11:02:13.810+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: Started Server@32c8e539{STARTING}[10.0.11,sto=0] @3440ms
2022-10-31 11:02:13.815+0000 [id=25]    INFO    winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled
2022-10-31 11:02:14.164+0000 [id=32]    INFO    jenkins.InitReactorRunner$1#onAttained: Started initialization
2022-10-31 11:02:14.209+0000 [id=35]    INFO    jenkins.InitReactorRunner$1#onAttained: Listed all plugins
2022-10-31 11:02:15.341+0000 [id=35]    INFO    jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
2022-10-31 11:02:15.348+0000 [id=37]    INFO    jenkins.InitReactorRunner$1#onAttained: Started all plugins
2022-10-31 11:02:15.360+0000 [id=32]    INFO    jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
2022-10-31 11:02:15.693+0000 [id=45]    INFO    jenkins.InitReactorRunner$1#onAttained: System config loaded
2022-10-31 11:02:15.694+0000 [id=45]    INFO    jenkins.InitReactorRunner$1#onAttained: System config adapted
2022-10-31 11:02:15.695+0000 [id=45]    INFO    jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
2022-10-31 11:02:15.697+0000 [id=33]    INFO    jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
2022-10-31 11:02:15.726+0000 [id=58]    INFO    hudson.model.AsyncPeriodicWork#lambda$doRun$1: Started Download metadata
2022-10-31 11:02:15.741+0000 [id=58]    INFO    hudson.util.Retrier#start: Attempt #1 to do the action check updates server
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/var/jenkins_home/war/WEB-INF/lib/groovy-all-2.4.21.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2022-10-31 11:02:16.463+0000 [id=39]    INFO    jenkins.install.SetupWizard#init:

*************************************************************
*************************************************************
*************************************************************

Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:

89aa6eaf805d451080a4ff21ede3f4ac

This may also be found at: /var/jenkins_home/secrets/initialAdminPassword

*************************************************************
*************************************************************
*************************************************************
Store the password displayed at the bottom (89aa6eaf805d451080a4ff21ede3f4ac here). The user id is admin. 

Jenkins container and pod can be viewed from docker desktop:
Jenkins dashboard can be accessed from http://localhost:8080/. 

Enter the admin password that was displayed on the console:
Click on "Install suggested plugins" button. This would install the recommended plugins. When installation is complete, continue as admin and click on save and finish. You will the see the Junkins dashboard:

    Leave a Comment


  • captcha text