Jenkins ZERO to HERO: A Complete Guide for Beginners


Introduction
Jenkins is one of the most popular Continuous Integration (CI) and Continuous Delivery (CD) tools used in DevOps. It helps automate the building, testing, and deployment of software, making the development process faster and more reliable.
If you're a beginner looking to master Jenkins from scratch, this guide will take you from ZERO to HERO with step-by-step explanations.
Table of Contents
1. What is Jenkins?
Jenkins is an open-source automation server that enables developers to automate:
Building code
Testing applications
Deploying software
It supports plugins for integrating with various DevOps tools like Git, Docker, Kubernetes, Maven, and more.
2. Why Use Jenkins?
✅ Automation: Reduces manual errors and speeds up development.
✅ Extensibility: 1,800+ plugins available.
✅ Scalability: Supports distributed builds across multiple machines.
✅ Community Support: Large open-source community.
✅ CI/CD Pipeline: Enables seamless integration and deployment.
3. Jenkins Architecture
Jenkins follows a master-agent architecture:
Master Node:
Manages jobs and pipelines.
Schedules builds.
Monitors agents.
Agent Nodes (Workers):
Execute jobs assigned by the master.
Can run on different OS environments.
4. Installation & Setup
Prerequisites:
Java (JDK 8 or 11) installed.
A machine (Windows/Linux/macOS).
Installation Steps:
On Windows:
Download the Jenkins
.war
file from https://www.jenkins.io/download/.Run Jenkins using:
java -jar jenkins.war
Access Jenkins at
http://localhost:8080
.
On Linux (Ubuntu):
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt update
sudo apt install jenkins
sudo systemctl start jenkins
sudo systemctl status jenkins
Access Jenkins at http://<your-server-ip>:8080
.
Initial Setup:
Unlock Jenkins using the initial admin password (found in
/var/lib/jenkins/secrets/initialAdminPassword
on Linux).Install recommended plugins.
Create an admin user.
5. Creating Your First Jenkins Job
Click "New Item" → Enter a name (e.g.,
My-First-Job
) → Select "Freestyle project".Under Build Steps, add:
- Execute Shell (Linux/macOS) or Batch Command (Windows).
echo "Hello, Jenkins!"
Click Save and then Build Now.
Check Console Output to see the result.
🎉 Congratulations! You’ve run your first Jenkins job.
6. Understanding Jenkins Pipelines
Jenkins Pipeline (using Jenkinsfile) allows defining CI/CD steps as code.
Example: Simple Declarative Pipeline
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building the application...'
}
}
stage('Test') {
steps {
echo 'Running tests...'
}
}
stage('Deploy') {
steps {
echo 'Deploying to production...'
}
}
}
}
Save this as
Jenkinsfile
in your Git repo.Create a Pipeline Job in Jenkins and point it to this file.
7. Integrating Jenkins with GitHub
Install the GitHub Plugin in Jenkins.
Create a Webhook in GitHub:
Go to Settings → Webhooks → Add webhook.
Set Payload URL to
http://<your-jenkins-server>/github-webhook/
.
Configure Jenkins Job:
Select GitHub hook trigger for GITScm polling.
Enter your repository URL.
Now, every Git push will trigger a Jenkins build automatically!
8. Best Practices
✔ Use Jenkinsfile (Pipeline as Code).
✔ Secure Jenkins (Enable authentication, use credentials).
✔ Backup Jenkins configurations.
✔ Use Docker agents for consistent builds.
✔ Monitor Jenkins (Use plugins like Blue Ocean for better visualization).
9. Conclusion
Jenkins is a powerful automation tool that can transform your DevOps workflow. By following this guide, you’ve learned:
Jenkins installation & setup.
Creating jobs & pipelines.
Integrating with GitHub.
Best practices for efficient CI/CD.
🚀 Now, go ahead and automate your projects like a PRO!
Next Steps
Explore Docker + Jenkins integration.
Learn about Jenkins Shared Libraries.
Try Jenkins on Kubernetes.
Happy Building! 🛠️
📢 Did you find this guide helpful? Share your thoughts in the comments!
#DevOps #Jenkins #CI/CD #Automation #TechBlog
Subscribe to my newsletter
Read articles from Sdeep directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Sdeep
Sdeep
👋 Hello! I'm passionate about DevOps and I'm proficient in a variety of cutting-edge technologies and always motivated to expand my knowledge and skills. Let's connect and grow together!