๐ Day 8/30 โ Jenkins Setup & Freestyle Project | DevOps Interview Preparation

Welcome to Day 8 of the 30 Days of DevOps Interview Preparation Challenge!
Today, weโll cover Jenkins, one of the most widely used CI/CD automation tools, and learn how to set it up along with our first Freestyle Project.
๐ 1. Understanding Jenkins
Jenkins is an open-source automation server written in Java. It helps automate:
Building code
Running tests
Deploying applications
โฆ all in a continuous integration and continuous delivery (CI/CD) pipeline.
Key Features:
Plugin Ecosystem: 1,800+ plugins to integrate with SCMs, build tools, cloud platforms.
Cross-Platform: Runs on Windows, macOS, Linux.
Extensible: Supports both Freestyle jobs and scripted pipelines.
Integration: Works with GitHub, Bitbucket, GitLab, AWS, Docker, Kubernetes, etc.
Why Jenkins is Popular in DevOps:
Free & Open Source
Huge community support
Flexible for small teams & enterprises
Easy to install and configure
๐ 2. Setting up Jenkins on AWS EC2
Weโll use Ubuntu 22.04 EC2 Instance for this setup.
Step 1 โ Launch an EC2 Instance
Go to AWS Console โ EC2 โ Launch Instance.
Select Ubuntu 22.04 LTS.
Instance type:
t2.small
or higher.Configure security group:
Allow SSH (22) from your IP.
Allow HTTP (80) from Anywhere.
Allow Custom TCP 8080 from Anywhere.
Launch the instance.
Step 2 โ Install Java
sudo apt update
sudo apt install -y openjdk-17-jdk
java -version
Step 3 โ Install Jenkins
curl -fsSL https://pkg.jenkins.io/debian/jenkins.io.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt update
sudo apt install -y jenkins
Step 4 โ Start & Enable Jenkins
sudo systemctl start jenkins
sudo systemctl enable jenkins
Step 5 โ Access Jenkins UI
Open browser:
http://<EC2-Public-IP>:8080
Get admin password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Paste it in the UI โ Install Suggested Plugins.
Create Admin User โ Save.
๐ 3. Creating Your First Freestyle Project
A Freestyle Project in Jenkins is a flexible, simple job configuration for building and deploying projects.
Steps:
On Jenkins Dashboard โ Click New Item.
Enter a name โ Select Freestyle project โ OK.
Source Code Management:
Select Git
Enter GitHub repo URL
Add credentials if private.
Build Triggers:
- Optionally enable Poll SCM or Build periodically.
Build Steps:
Click Add build step โ Select Execute shell.
Example:
echo "Building project..." mvn package
Save โ Click Build Now.
Check Console Output to see logs.
๐ฏ 4. Interview Preparation Guide
Common Jenkins Interview Questions:
Q1: What is Jenkins and why do we use it?
A: Jenkins is an open-source automation server that helps implement CI/CD by automating the build, test, and deployment processes. It increases software delivery speed, ensures consistency, and reduces human errors.
Q2: What is the difference between Freestyle and Pipeline jobs?
A:
Freestyle: GUI-based configuration, simpler, less scalable for complex workflows.
Pipeline: Code-as-configuration (
Jenkinsfile
), better for complex, multi-step, version-controlled pipelines.
Q3: How can you secure Jenkins?
A:
Enable authentication & authorization.
Use Role-Based Access Control (RBAC) plugins.
Secure Jenkins with HTTPS.
Restrict script execution.
Keep Jenkins and plugins updated.
Q4: How do you integrate GitHub with Jenkins?
A:
Install Git plugin.
Configure GitHub webhook to
http://<jenkins-url>/github-webhook/
.Add repo URL in job SCM settings.
Q5: What are some useful plugins for Jenkins?
A:
Git plugin
Pipeline plugin
Email Extension
Blue Ocean UI
Docker plugin
๐ก Pro Tips for Real Projects
Use Pipeline jobs for scalability, Freestyle for quick tasks.
Keep Jenkins jobs & configs in source control.
Set up build notifications (Slack, Email).
Use agents for isolated builds to avoid conflicts.
๐ Conclusion:
Today, we learned how to set up Jenkins on AWS EC2, create our first Freestyle Project, and prepare for Jenkins-related interview questions. Tomorrow, weโll go deeper into Jenkins Pipeline Projects.
#30DaysOfDevOps #Day8 #Jenkins #AWS #DevOpsInterviewPrep #FreestyleProject #CICD #HashnodeBlog
Subscribe to my newsletter
Read articles from Tathagat Gaikwad directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
