Logo

dev-resources.site

for different kinds of informations.

Mastering Jenkins: A Step-by-Step Guide to Setting Up and Supercharging Your CI/CD Workflow

Published at
1/7/2025
Categories
devops
jenkins
setup
linux
Author
hashim_hb
Categories
4 categories in total
devops
open
jenkins
open
setup
open
linux
open
Author
9 person written this
hashim_hb
open
Mastering Jenkins: A Step-by-Step Guide to Setting Up and Supercharging Your CI/CD Workflow

What is Jenkins?

→ Jenkins is an open-source tool used to automate tasks in software development, mainly focusing on Continuous Integration (CI) and Continuous Delivery (CD).

→ It also helps developers automatically build, test, and deploy their code changes whenever they make updates.

Features of Jenkins:

  • CI/CD INTEGRATIONS

  • PIPELINES

  • EASY INSTALLATION

  • EASY CONFIGURATION

  • DISTRIBUTED

  • EXTENSIBLE

  • OPEN-SOURCE

How to Set Up Jenkins in your Local Machine?

☆ There are many ways in which can set up you can choose which suits you the best

Image description

✦ You can set up in Windows also but I am going to teach you how we can setup Jenkins locally with Oracle VirtualBox VM.

✦ First create a VM (Virtual Machine) using a Virtual Box and install the Linux (Ubuntu/CentOS) as your wish

Image description

✦ Open Terminal in any one of the following Linux Distros it might be different for UBUNTU you can check Jenkins documentation for that I will guide you for CentOS.

sudo wget -O /etc/yum.repos.d/jenkins.repo \ https://pkg.jenkins.io/redhat-stable/jenkins.repo
Enter fullscreen mode Exit fullscreen mode
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
sudo yum upgrade
Enter fullscreen mode Exit fullscreen mode
# Add required dependencies for the jenkins package
sudo yum install fontconfig java-17-openjdk
sudo yum install jenkins
sudo systemctl daemon-reload
Enter fullscreen mode Exit fullscreen mode

✦ Start Jenkins by using systemctl

sudo systemctl enable jenkins
sudo systemctl start jenkins # to start jenkins
sudo systemctl status jenkins # to check the status if its running or not 
Enter fullscreen mode Exit fullscreen mode

✦ If everything went well, the beginning of the status output shows that the service is active and configured to start at boot(enabled)

Image description

✦ Now that Jenkins is up and running, let’s adjust our firewall rules so that we can reach it from a web browser to complete the initial setup.

IMPORTANT STEP :

✦ check if firewall is installed in the system

sudo yum install firewalld
sudo systemctl enable firewalld
sudo reboot
Enter fullscreen mode Exit fullscreen mode

✦ Now everything is done now we can start using Jenkins

ifconfig
Enter fullscreen mode Exit fullscreen mode

✦ By running this command we get the IP-Address of Linux system use this IP-Address to access the Jenkins dashboard in the web-browser by typing ipaddress:8080 and enter

✦ This will successfully Land you to this page:

Image description

✦ Use the terminal in your VM and run

sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Enter fullscreen mode Exit fullscreen mode

✦ Copy the 32-character alphanumeric password from the terminal and paste it into the Administrator password field on the Jenkins page. Then, click Continue.

Image description

✦ Click on Install suggested plugins

Image description

✦ It will Install the required plugins

Image description
✦ Once all the plugins are installed then:

Image description
✦ Fill in the required fields and proceed

Image description
✦ URL will be provided i have removed for security purposes just click on save and finish

Image description
✦ Now you have successfully done the setup for Jenkins

Image description
✦ This is what the Jenkins Dashboard Looks like

Now this is for the Linux system it will only run in Linux environment if we want to access in our local machine (Windows) you need to follow certain steps:

In Linux environment run the following commands:

sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp
sudo firewall-cmd --reload
Enter fullscreen mode Exit fullscreen mode

✦ Both the commands should give SUCCESS or else you have done something wrong

Setting Up Port Forwarding

  1. Open VirtualBox VM settings.

  2. Navigate to the NAT network adapter settings.

  3. Click Advanced and then Port Forwarding.

  4. Add a new rule named "Jenkins".

  5. Set Protocol to TCP.

  6. Enter Host IP as 127.0.0.1 and Host Port as 8080.

  7. Guest Port should also be set to 8080.

  8. Click OK to save the settings.

Image description

After this step→ Open your browser and go to 127.0.0.1:8080 to access Jenkins, you will land on the getting started Jenkins page:

Image description

✦ Enter the Username and Password which you created Before and there you go

✦ You have Successfully setup Jenkins in your Local Machine

How to create Jenkins first Job?

✦ Click on → Create a Job

Image description

✦ Then give a name for the job and select freestyle Project as we are just starting off.

Image description
✦ You will get a page something like this:

Image description
✦Scroll down to Build Steps:

Image description
✦Choose the option what you like

✦We will choose Execute Shell and write the command that you want to execute and save

Image description

Image description

✦ Now just click on Build Now and that it you have successfully created your first job in Jenkins

✦ After the job is created click on the job and get to see the following:

Image description

Image description

✦ This was the output and we successfully created and saw the output of the command in Jenkins

✦ We can even see the number of jobs that we have created

Image description
✦ This was all about Jenkins Hope You guys like it.

jenkins Article's
30 articles in total
Favicon
Mastering Cost Optimisation with Shell Scripting: Automate Log Storage in S3 for Budget-Friendly Infrastructure
Favicon
Can’t access username or password, forgot these credentials after installing Jenkins
Favicon
Deploying a Next.js UI App on S3 Using Jenkins🤩
Favicon
How to install Jenkins in ubuntu
Favicon
Integrating Maven with Jenkins: A Step-by-Step Guide
Favicon
"Is Jenkins better than Docker? Or are they meant for different purposes?"
Favicon
Can a Python Server (Serving HTML with Jinja2) Interact and Modify Files in a Jenkins Pipeline?
Favicon
Streamlining CI/CD: A Complete Guide to Installing Jenkins on AWS EC2
Favicon
[Boost]
Favicon
Best Practices of Optimizing CI/CD Pipelines: Jenkins Consultancy
Favicon
deploy Jenkins using docker compose with production ready
Favicon
Pipeline CD en Jenkins para terraform AWS EKS
Favicon
[Boost]
Favicon
Mastering Jenkins: A Step-by-Step Guide to Setting Up and Supercharging Your CI/CD Workflow
Favicon
13 Best DevOps Tools for Enhancing Business Processes
Favicon
A Complete Guide to Setting Up Nexus (2 Ways) + How to Connect Nexus to Jenkins
Favicon
Automating Kubernetes Deployments with CI/CD Pipelines (GitLab, Jenkins)
Favicon
Accelerate Releases with Shift-Left Validation: A Custom CI/CD Configuration Framework
Favicon
Ci CD pipeline with Jenkins
Favicon
Building a Secure and Scalable CI/CD Pipeline for EKS Using Jenkins and GitHub Actions
Favicon
Strategies for Improving Jenkins Pipeline Performance: Best Practices and Implementation
Favicon
Connecting Jenkins to Slack: A Beginner's Guide
Favicon
From 41 Minutes to 8 Minutes: How I Made Our CI/CD Pipeline 5x Faster
Favicon
Jenkins Guide for Beginners
Favicon
DevOps and Security: How To Build Resilient Pipelines
Favicon
Cómo instalar Jenkins en AWS: Guía paso a paso
Favicon
Automating Docker Workflows with Jenkins: A Complete Guide
Favicon
Top 5 Free DevOps Certification Courses to Boost Your Career!
Favicon
Jenkins with PHP – Run Your First Pipeline
Favicon
How to Manage Terraform with Jenkins

Featured ones: