Jenkins Essentials: A Beginner’s Guide to Fundamentals, Installation, and Setup
Last updated on: February 25, 2025
Notesly Team
School Student
1. Introduction to Jenkins
What is Jenkins?
Jenkins is an open-source automation server used to automate software development processes such as building, testing, and deploying applications. It helps developers integrate code changes continuously and ensures high software quality.
Importance of Jenkins in DevOps
Jenkins plays a vital role in DevOps by enabling Continuous Integration (CI) and Continuous Deployment (CD). It automates repetitive tasks, accelerates the software release cycle, and ensures smooth collaboration between development and operations teams.
Key Features of Jenkins
- Open-source and Extensible: Supports hundreds of plugins.
- Distributed Builds: Can run on multiple machines for efficient execution.
- Easy Integration: Works with Git, Docker, Kubernetes, and more.
- Pipeline as Code: Uses Jenkinsfile to define automation workflows.
2. Understanding CI/CD and Jenkins' Role
What is Continuous Integration (CI)?
CI is a development practice where developers frequently merge code changes into a shared repository, automatically triggering builds and tests.
What is Continuous Deployment/Delivery (CD)?
- Continuous Delivery: Ensures every change is deployable at any time but requires manual approval.
- Continuous Deployment: Automatically deploys every change to production after passing tests.
How Jenkins Automates CI/CD
Jenkins automates CI/CD by:
- Pulling code from version control systems like GitHub.
- Running automated tests.
- Deploying applications to staging or production environments.
3. Prerequisites for Installing Jenkins
System Requirements
- Minimum: 512MB RAM, 1GB disk space
- Recommended: 4GB RAM, SSD, multi-core processor
Supported Operating Systems
- Windows
- Linux (Ubuntu, CentOS, Debian)
- macOS
Software Dependencies
- Java (JDK 11 or later)
- Web Browser (for UI access)
- Optional: Docker (for containerized installations)
4. Installing Jenkins on Different Platforms
Windows Installation
- Download the Jenkins Windows Installer (.msi) from jenkins.io.
- Run the installer and follow the setup wizard.
- Start the Jenkins service and access it via
http://localhost:8080
.
Linux (Ubuntu/CentOS) Installation
- Install Java:
sudo apt install openjdk-11-jdk
- Add the Jenkins repository and install Jenkins:
- Start Jenkins:
sudo systemctl start jenkins
Mac Installation
- Install Homebrew (if not installed).
- Run:
brew install jenkins-lts
- Start Jenkins:
brew services start jenkins-lts
Docker Installation (Optional)
- Install Docker on your system.
- Run Jenkins using Docker:
5. Setting Up Jenkins for First Use
Starting the Jenkins Service
After installation, Jenkins runs as a service. You can access it via http://localhost:8080
in a browser.
Unlocking Jenkins and Initial Configuration
- Locate the initial admin password from the terminal or log file (
/var/lib/jenkins/secrets/initialAdminPassword
).
- Enter the password on the Jenkins UI to proceed.
Installing Recommended Plugins
Jenkins suggests installing essential plugins like Git, Pipeline, and Build Tools. Select "Install Suggested Plugins."
Creating the First Admin User
Set up an administrator account with a username and password for secure access.
6. Exploring Jenkins Dashboard
Overview of the UI
- Dashboard: Displays all jobs and builds.
- New Item: Create jobs and pipelines.
- Manage Jenkins: System settings and plugin management.
Understanding Jobs, Pipelines, and Builds
- Jobs: Define automation tasks (Freestyle, Pipeline, etc.).
- Pipelines: Advanced scripting for multi-step workflows.
- Builds: Execution of a job triggered manually or automatically.
Configuring Global Settings
Modify settings like system logs, security, and node configurations.
7. Creating Your First Jenkins Job
Freestyle Project vs Pipeline
- Freestyle Project: Simple UI-based job for basic tasks.
- Pipeline: Script-based workflow automation using Groovy.
Running a Simple Job
- Click New Item > Select Freestyle Project.
- Configure Source Code Management (Git, SVN).
- Add a Build Step (e.g., Run Shell Script).
- Save and trigger the build.
Viewing Build Logs and Results
- Click on the job and check the Console Output for logs.
- View build status: Success , Failure , Unstable .
8. Troubleshooting Common Issues
Installation Errors and Fixes
- Jenkins Not Starting: Check logs using
journalctl -u jenkins
. - Java Version Issue: Ensure Java 11+ is installed.
Plugin Conflicts
- Solution: Update plugins from Manage Jenkins > Plugin Manager.
- Rollback Option: Disable problematic plugins.
Port and Firewall Issues
- Port 8080 Already in Use? Change it via
JENKINS_PORT=9090
. - Firewall Blocking Jenkins? Allow access:
Conclusion and Next Steps
- You’ve learned Jenkins fundamentals, installation, and setup.
- Next, explore advanced features like Jenkins pipelines, integration with GitHub, and deployment strategies.
- Keep experimenting with Jenkins to automate your software delivery process!
