Day 22 of #90DaysOfDevops || Getting Started with Jenkins 😃

Day 22 of #90DaysOfDevops || Getting Started with Jenkins 😃

·

4 min read

What is Jenkins?

  • Jenkins is an open source continuous integration-continuous delivery and deployment (CI/CD) automation software DevOps tool written in the Java programming language. It is used to implement CI/CD workflows, called pipelines.

  • Jenkins is a tool that is used for automation, and it is an open-source server that allows all the developers to build, test and deploy software. It works or runs on java as it is written in java. By using Jenkins we can make a continuous integration of projects(jobs) or end-to-endpoint automation.

  • Jenkins achieves Continuous Integration with the help of plugins. Plugins allow the integration of Various DevOps stages. If you want to integrate a particular tool, you need to install the plugins for that tool. For example Git, Maven 2 project, Amazon EC2, HTML publisher etc.

Let us do discuss the necessity of this tool before going ahead to the procedural part for installation:

  • Nowadays, humans are becoming lazy😴 day by day so even having digital screens and just one click button in front of us then also need some automation.

  • Here, I’m referring to that part of automation where we need not have to look upon a process(here called a job) for completion and after it doing another job. For that, we have Jenkins with us.

Jenkins Installation

Prerequisites:

Minimum hardware requirements:

  • 256 MB of RAM

  • 1 GB of drive space (although 10 GB is a recommended minimum if running Jenkins as a Docker container)

For Long term support

curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.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-stable binary/ | sudo tee \
  /etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins

Also need java version 11

sudo apt install openjdk-11-jre
java -version
#openjdk version "11.0.12" 2021-07-20
#OpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2)
#OpenJDK 64-Bit Server VM (build 11.0.12+7-post-Debian-2, mixed mode, sharing)

Now after installation on EC2 instance jenkins can be accessible on broser on port 8080 which is default port oe jenkins.

We can also check jenkins is up or not by command service jenkins status

Next we need to extract the initial password from given [ath as given copy it and on instance where jenkins installed just cat <paste the path> . It will give password copy the password and enter in the field and continue.

Next it will ask to install required plugins of move and install later. Good to install selected plugins as of now.

After plugins installed it will ask to create admin . fill the required details and apssword. Hit save and conitnue.

It will set the instance configuration that is set the url. You can set url name as of choice with port assigned to it 8080.

Next hit start using jenkins and there will be jenkins page for you ready to create CI/CD pipelines.

Task 2

Create a freestyle pipeline to print "Hello World!!

  • Start jenkins server and inside platform there is option to create new item hit that

  • Next select free style project and hot ok and also provide name for the project

  • Next fill the description (optional) and scroll down and find the execute prompt

  • Here in build step prompt choose execute shell. A shell prompt will be there write down code to be executed and save it

  • New page will appear and there we have option to build. Hit that option and there we can see new pipeline is running and on it's succes it shows green.

  • Now after succes build it will look like

  • Now to check the log. select the build under build history and on new page it shows console log. There we can see the log after success build.

  • Our build shows Hello world as success buid of pipeline.

End of the post.


Reach me on:

  1. Github-> github.com/Hrmn97

  2. Twitter -> twitter.com/Harman9765

  3. LinkedIn -> linkedin.com/in/chetan-harman-56310424a

  4. Website -> devhrmn.netlify.app

Â