DEV Community

Cover image for Day-22 : Getting Started with Jenkins
On-cloud7
On-cloud7

Posted on

Day-22 : Getting Started with Jenkins

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.

Steps to Create a freestyle pipeline to print “Hello World!!

Step 1: Create an AWS EC2 instance.

Image description

Step 2: Install Jenkins on the EC2 instance.

For steps to install jenkins check:
1.sudo apt update

2.sudo apt install openjdk-17-jre

3.java -version

4.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

5.sudo apt-get update

6.sudo apt-get install jenkins

7.sudo systemctl enable jenkins

8.sudo systemctl start jenkins

9.sudo systemctl status jenkins

Step 3: Access Jenkins on the browser using the public IP of the EC2 instance and 8080 port.

Image description

Image description

Image description

Step 4: Create a new item in Jenkins using freestyle project type.

Step 5: Give a name to the Project “HelloWorld”

Image description

Step 6: In the configuration section, in the “Build” section, add an “Execute shell” build step

Image description

Step 7: Add the command to print “Hello World”.

Image description

Step 8: “Save” it to create the project.

Image description

Step 9: Now click on the “Build Now” to run the project.

Image description

Step 10: Check the console output for “Hello World” message.

Top comments (0)