Day 22: Getting Started with Jenkins

Day 22: 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.

Why do we need Jenkins?

  • Jenkins automates repetitive tasks, reducing manual interventions in building, testing, and deploying code.

  • It speeds up code integration and delivery, making development teams more efficient.

  • Jenkins ensures consistent build and deployment processes, reducing errors and improving software quality.

  • It fosters collaboration among development, testing, and operations teams through centralized CI/CD.

  • Jenkins scales to handle complex projects and growing workloads.

  • It seamlessly integrates with various tools to create comprehensive automation workflows.

  • Jenkins is widely used in DevOps, enhancing career prospects for professionals in the software development field.

Installation of Jenkins

Before we get into some hands-on tasks, you need to install Jenkins on your system. So, here's the link where you can install Jenkins

https://www.jenkins.io/doc/book/installing/linux/

Before installing the Jenkins, you must install the Java as well. Click on the given link, there's also a selection about the installation of Java. First, Install the java and then go for the long-term support release version of Jenkins in that link.

Freestyle Jenkins pipeline:

  1. Create a freestyle pipeline to print "Hello World!!" using Jenkins

Steps:

  • Create an instance on AWS ec2, and connect via ssh in your command prompt or terminal.

  • Update the system first and install the Java as I mentioned above by using the link above.

  • After installing Java, install Jenkins in your system by using the link above.

  • Once you installed Jenkins, go to your instance's security rule edit inbound rules and add the rule of port 8080 to my IP. Because the Jenkins runs on port 8080.

  • The first you access the Jenkins it will show the screen like this

  • Copy the red colour line. Do sudo cat and paste the line in your terminal or command prompt.

      sudo cat /var/lib/jenkins/secrets/initialAdminPassword
    
  • It will give you some private passwords. Just copy and paste the password to the administrator password and click on continue.

  • Then it will ask you to install a suggested plugin or custom plugin. Click on the suggested plugin

    The plugins will be installed automatically.

  • Then it will ask you to set your username and password for Jenkins.

    Fill out your information for Jenkins, click on save and Continue

  • It will lead you to the home page of Jenkins.

  • Click on Create a job.

  • Write any name of your freestyle project, select the freestyle project and click OK.

  • Write any description for your project.

  • Select the source code management none, if you aren't using any project from Git.

  • If you give some build triggers, you can choose according to your project. In this case, we shouldn't select any build triggers yet.

  • Go to build steps and select execute shell.

  • Write some commands in the shell.

  • After writing the commands, save the project.

  • Click on Build Now to run the project.

  • Your project will run successfully and show the output of the command you write in the shell.

  • Congratulations, you have created your first Jenkins freestyle project.


<That's all for today. Hope you link it. FOLLOW to join me in the journey of DevOps>

ย