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.

setup Article's
30 articles in total
Favicon
.NET DEVELOPER TOOLS NEED TO INSTALL FOR NEWLY PC
Favicon
Exploring Localhost 127.0.0.1:49342: Setup and Usage Guide
Favicon
Mastering Jenkins: A Step-by-Step Guide to Setting Up and Supercharging Your CI/CD Workflow
Favicon
Personal TODO list on how I set up my dev machine
Favicon
Cómo usar varias SSH keys para diferentes repositorios de GitHub (o GitLab)
Favicon
Tech and Tools I use
Favicon
How to Set Up a New TypeScript Project
Favicon
How to install SDL2 on macOS
Favicon
Multiple Node.js versions - setup memo
Favicon
Elevate Your Gaming Setup: Affordable Alternatives for Setup Gaming
Favicon
How to set up HTMX in Django
Favicon
Créez Votre Configuration p Jeu Parfaite : Découvrez nos Offres dès Aujourd'hui !
Favicon
Kitty + Neovim: Aesthetic Dev Setup
Favicon
Um pouco de mim
Favicon
Pop_OS Japanese layout
Favicon
The fastest setup of enhanced conversions for Google Ads.
Favicon
zsh: command not found: brew
Favicon
Dill Processing Plant Plant Project Report 2024, Setup Details, Machinery Requirements and Cost Analysis
Favicon
Hair Oil Manufacturing Plant Project Report 2024, Cost, Industry Trends and Business Opportunities
Favicon
Glutamic Acid Manufacturing Plant Project Report 2024, Machinery, Cost and Raw Material Requirements
Favicon
How to set up Python for backend development
Favicon
Setting Up Your macOS Development Environment and Automating Backups.
Favicon
What is use for work as a developer - Basic Flutter setup
Favicon
Trabalhando com 2 pc's no setup,Dicas!🖥️
Favicon
The JavaScript Developer's Guide to Ubuntu on Windows 11 with WSL
Favicon
My Kubernetes Lab Setup - Using Vagrant & Docker
Favicon
Setup MacMini M1 for Development
Favicon
Setup MacMini M1 for Development
Favicon
How to install and setup Neovim with awesome plugins
Favicon
Redis Local setup

Featured ones: