Skip to main content

Jenkins Setup

1. Windows Installation

Windows Installer

Download the .msi installer from Jenkins website and run it.

Jenkins will:

  • Install as Windows Service
  • Start automatically
  • Run on port 8080

Password location:

C:\Program Files\Jenkins\secrets\initialAdminPassword

2. macOS Installation

Install Jenkins LTS

brew install jenkins-lts

Start Jenkins

brew services start jenkins-lts

Access:

http://localhost:8080

Password:

cat ~/.jenkins/secrets/initialAdminPassword

3. Linux Installation

Install Java

sudo apt update
sudo apt install openjdk-17-jdk -y

Add Jenkins Repository

sudo wget -O /etc/apt/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2026.key

echo "deb [signed-by=/etc/apt/keyrings/jenkins-keyring.asc]" \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null

Install Jenkins

sudo apt update
sudo apt install jenkins -y

Start Jenkins

sudo systemctl start jenkins
sudo systemctl enable jenkins

Access:

http://<server-ip>:8080

Password:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Creating a Pipeline Job in Jenkins

This section explains step-by-step how to create a Pipeline Job in Jenkins.

Step 1: Login to Jenkins

Open your browser:

http://localhost:8080

Login using your admin credentials.


Step 2: Create New Item

  1. Click New Item (left menu)
  2. Enter a name (Example: sample-pipeline)
  3. Select Pipeline
  4. Click OK

Step 3: Configure Pipeline

Scroll to the Pipeline section.

You will see:

Definition:

  • Pipeline script (write script directly in Jenkins)
  • Pipeline script from SCM (recommended for production)

Option A: Pipeline Script (Basic Example)

Select:

Definition → Pipeline script

Paste this example:

pipeline {
agent any

stages {
stage('Build') {
steps {
echo 'Building the application'
}
}

stage('Test') {
steps {
echo 'Running tests'
}
}

stage('Deploy') {
steps {
echo 'Deploying application'
}
}
}
}

Click Save.


Step 4: Build the Pipeline

Click:

Build Now

You can view progress in:

Console Output