Jenkins Explained: From Installation to Continuous Deployment

Jenkins Explained: From Installation to Continuous Deployment

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 Jenkins?

Automation: Jenkins streamlines repetitive tasks throughout the software development lifecycle, including building, testing, and deploying code. This not only cuts down manual effort but also reduces errors and accelerates development.

Continuous Integration (CI): Jenkins enables CI by automatically building and testing code with each new push to the repository. This proactive approach aids in the early detection and resolution of bugs, ultimately enhancing software quality.

Continuous Deployment (CD): Jenkins facilitates CD by automating code deployment to various environments like staging and production post successful CI. This ensures swift and dependable software releases.

Scalability: Jenkins boasts horizontal scalability, allowing it to handle large CI/CD workloads by distributing build jobs across multiple nodes. This scalability ensures seamless support for growing development teams and projects.

Integration with Tools: Jenkins seamlessly integrates with a diverse array of tools and technologies, spanning version control systems, build tools, testing frameworks, and deployment tools. This integration fosters a cohesive development workflow, promoting collaboration among team members.

Customization: Jenkins offers extensive customization options through its plugins and support for defining pipelines as code. This empowers you to tailor Jenkins to suit your unique development and deployment needs.

Steps to Install Jenkins:

Step 1:

 sudo apt-get update

When you run the sudo apt-get update command, it updates my package list and installs the latest versions of all packages. It's like giving your computer a quick refresh!

Step 2:

sudo apt install openjdk-11-jre

When you enter the command sudo apt-get install openjdk-11-jdk in the terminal, the package manager apt-get will download and install the OpenJDK 11 JDK on your Linux system.

To check if Java was installed correctly,

java -version

Step 3:

Copy

sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
  https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
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

These two commands download the Jenkins package repository key, store it in a keyring file, and add the repository to the system's list of software sources so that the Jenkins package can be installed or updated via the package manager (apt-get).

Step 4:

sudo apt-get update

Step 5:

sudo apt-get install jenkins

When you enter the command sudo apt-get install jenkins in the terminal, the package manager apt-get will download and install the Jenkins software package on your Linux system. Once installed, you can access Jenkins in your web browser at http://localhost:8080 to start configuring and using it for your software development needs.

If you reached until this step that means you have successfully installed Jenkins on your OS.

After Installation:

Enable/Start your Jenkins Service and check the status

sudo systemctl start jenkins.service
sudo systemctl status jenkins

Access your Jenkins by using the below URL

URL: https://<localhost>:8080

Note: Replace localhost with your instance Public IP.

You will land here once you hit the URL:

To get the Admin Password use the below command:

Copy

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

copy the output and paste it in password section and hit Continue.

You will land here:

Click on Install suggested plugins

Once everything is becomes Green

Give the details and hit Save and Continue.

NOW JENKINS IS READY!!

Conclusion:

Jenkins is a powerful and versatile tool that plays a crucial role in modern software development by automating the processes of building, testing, and deploying applications. Its extensive plugin ecosystem, scalability, and ability to integrate with various tools make it an indispensable asset for DevOps teams. By following the installation steps outlined, you can quickly set up Jenkins and start leveraging its capabilities to streamline your CI/CD workflows, ultimately enhancing productivity and software quality.