Getting Started with Jenkins

Getting Started with Jenkins

Day 22 of 90daysofdevops

ยท

3 min read

What is Jenkins?

  • Jenkins is a Java-based open-source automation server that helps facilitate the continuous integration and delivery (CI/CD) of software projects. It provides a framework for building, testing, and deploying applications, making it easier for development teams to automate various tasks in the software development lifecycle.

  • Jenkins supports a wide range of plugins that extend its functionality, allowing integration with various tools and technologies commonly used in software development. It can work with version control systems like Git, build tools like Maven or Gradle, testing frameworks, deployment tools, and more.

Advantages of Using Jenkins

There are several advantages to using Jenkins as an automation server for your software development processes. Some of the key benefits include:

  1. Continuous Integration and Delivery (CI/CD): Jenkins facilitates the automation of building, testing, and deploying software applications, enabling teams to implement CI/CD practices.

  2. Easy Configuration and Extensibility: Jenkins provides a user-friendly web interface for configuring build pipelines and workflows.

  3. Scalability: Jenkins supports distributed builds, allowing you to distribute build workloads across multiple machines or agents. This enables faster build times and improves the scalability of your CI/CD processes in complex projects.

  4. Vast Plugin Ecosystem: Jenkins has a vast ecosystem of plugins that extend its functionality and enable integration with a wide range of tools and technologies.

  5. Open Source and Active Community: Jenkins is an open-source project with a large and active community. This means there is extensive documentation, resources, and community support available.

  6. Flexibility and Portability: Jenkins is platform-independent and can run on various operating systems. You can deploy it on your local machine, on-premises servers, or in the cloud.

  7. Robust Security: Jenkins provides features for securing your automation processes, including user authentication, authorization, and access control.

Installation of Jenkins

  1. As Jenkins is Java based. So we have to install Java first.

     sudo apt update
     #Install Java
     sudo apt install openjdk-11-jre
     # Check the Java version for validation
     java -version
    

  2. Installation of Jenkins

    Jenkins Official Installation Docs

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

     sudo systemctl enable jenkins
    
     sudo systemctl start jenkins
    
     sudo systemctl status jenkins
    

  4. Now open port 8080 using IPv4 address and access the Jenkins in the browser.

  5. Now we have to get the admin password from the server.

  6. Now get the admin password and paste it into the Jenkins server.

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

  7. Install suggested plugins

  8. Now we have to create an admin user

  9. Now we are into the Jenkins dashboard.


Create a freestyle pipeline to print "Hello World"

  1. Create a new Job

  2. Create a freestyle project named as HelloWorld

  3. In the Build Step choose select Execute Shell and Save those changes.

     echo "Hello World"
    

  4. Now click on Build Now

  5. Now in the console output, we will get a successful build and get the output.

Thank You,

I want to express my deepest gratitude to each and every one of you who has taken the time to read, engage, and support my journey.

Feel free to reach out to me if any corrections or add-ons are required on blogs. Your feedback is always welcome & appreciated.

~ Abhisek Moharana ๐Ÿ˜Š

ย