Jenkins — Installation and Setup
Please visit my website and subscribe to my youtube channel for more articles
Install on Linux
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.reposudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.keysudo yum install jenkinssudo yum install gitsudo service jenkins start
Open the url in the browser. Default port is 8080
It will ask for the initial password, please run the below command
cat /var/lib/jenkins/secrets/initialAdminPassword
Two methods to install Jenkins on Windows
- Download jenkins.war file and and deploy that war file on tomcat .
- In Command Prompt Run the following command:
java -jar jenkins.war — httpPort=8080
- Normal download whole software and install it http://mirrors.jenkins.io/windows/latest
- http://localhost:8080
- Login and default password is present in admin and secrets/initialAdminPassword
Run as a Window Service
- If you have install it as a windows installer then it automatically running as a Windows Service.
- If not, then Go to Manage Plugin and click on Install as a Window Service
Change the default port
- Change jenkins.xml file
Configure Windows Slave Agent
Manage Jenkins -> Global Tool Configuration ->Agents as shown below

Once this is enabled you will see the option in Launch method “Launch agent via Java Web Start” in the below steps
Now go to Manage Jenkins -> Manage Nodes -> Add Node

Login to your windows machine
Install Java on Windows Machine
Install git on Windows Machine
Set path
C:\Program Files\Git\cmd
%JAVA_HOME%\bin
Download the jdk-8u161-windows-x64.exe and install it
Click on agent.jar to download agent.jar
Copy agent.jar to the remote agent

Run from agent command line:
java -jar agent.jar -jnlpUrl http://127.0.0.1:8080/computer/WindowsSlave/slave-agent.jnlp -secret 40ff8dd0b5e437cdfaa670d3a6844304e9644a78118f645f2b1a0cb3106ede04 -workDir "D:\WindowsJenkinsSlave"
Once command is successful, you will see the below screenshot

Jenkins Setup with Windows Slave is completed successfully.
Configure Java_home,GIT,Maven,Gradle
- Manage Plugins -> Global Tool Configuration


Create a freestyle project for ANT and Maven
- Create a sample project and commit in github
- Create build.xml and commit it with the code ( Need to research if i need to use different xml file on different location)
Run Jenkins build from eclipse
- Download myvln
Back up and Restore Jenkins
Install pLugins
- Dashboard View, Deploy to Container Plugin,Monitoring,Audit Trail,disk-usage plugin ,backup plugin
- Create back up and then restore
Jenkins Command Line
- Download jar from this location : jenkinsurl/jnlpJars/jenkins-cli.jar
2. java -jar jenkins-cli.jar -s http://localhost:8080/ help
ERROR: You must authenticate to access this Jenkins.
Jenkins CLI
http://localhost:8080/user/nidhigupta/configure
Configuration
- YOu can change config.xml for like increasing the number of executor
Disk Usage
- Go to Dashboard | Manage Jenkins | Disk Usage:
Integrate sonar with Jenkins
- Install plugins : Sonar quality Gates Plugin, SonarQube scanner for Jenkins
- Get the token from sonarqube to integrate with sonar
- Configure sonar — Manage Jenkins->Configure System
- Configure sonar-runner — Manage Jenkins — Global Tool Configuration
- In job , add build — execute sonar -> and that will do the anaylysis of files.
JFrog Artifactory
Download from https://bintray.com/jfrog/artifactory/jfrog-artifactory-oss-zip/5.9.1
Run artifactory.bat for windows
http://localhost:8081/artifactory/webapp/#/home
Default username/password = admin/password
Unit Testing Plugin
TestNG Result Plugin