☑️Day 48: Installing Jenkins on Ubuntu

☑️Day 48: Installing Jenkins on Ubuntu

Jenkins is a popular open-source automation server that helps automate parts of the software development process like building, testing, and deploying applications. Below is a detailed step-by-step guide on the installation process along with explanations for each command used.


1. Updating the Package List

  • Command:

      sudo apt update
    
  • Explanation: This command updates the local package index with the latest changes made in the repositories, ensuring that the system can install the latest version of the packages.

2. Installing Java (OpenJDK)

  • Command:

      sudo apt install openjdk-17-jre
    
  • Explanation: Jenkins requires Java to run. This command installs the OpenJDK 17 runtime environment on the machine.

  • Verification: To confirm the installation:

    • Command:

        java -version
      
    • Explanation: This checks the installed Java version and ensures that Java is correctly set up on the machine.

3. Downloading Jenkins Package

  • Command:

      wget https://pkg.jenkins.io/debian-stable/binary/jenkins_2.401.1_all.deb
    
  • Explanation: This command uses wget to download the Jenkins Debian package (.deb file) from the official Jenkins repository. The specified version here is 2.401.1.

4. Installing Jenkins Package

  • Command:

      sudo dpkg -i jenkins_2.401.1_all.deb
    
  • Explanation: This command installs the Jenkins package. The dpkg -i command tells the system to install the .deb package.

  • Note: If there are any dependency issues after running the above command, use the next step to fix them.

5. Fixing Missing Dependencies

  • Command:

      sudo apt-get -f install
    
  • Explanation: This command attempts to correct any broken dependencies that may have resulted from the previous installation step.

6. Managing Package Installations and Holds

  • Command:

      sudo apt-mark showhold
    
  • Explanation: This command shows packages on hold, meaning they won't be automatically upgraded.

  • Command:

      sudo apt-mark unhold <package_name>
    
  • Explanation: This removes the hold on a package, allowing it to be updated. Replace <package_name> with the actual package name you wish to unhold.

7. Cleaning Up Package Cache

  • Command:

      sudo apt-get clean
    
  • Explanation: This command clears the local repository of downloaded package files. It helps free up space and ensures the system only retains necessary files.

8. Updating and Installing Jenkins

  • Command:

      sudo apt-get update
    
  • Explanation: This updates the package index again after cleaning.

  • Command:

      sudo apt-get install jenkins
    
  • Explanation: This installs Jenkins and ensures it is up to date.

9. Accessing the Jenkins Initial Admin Password

  • Command:

      sudo cat /var/lib/jenkins/secrets/initialAdminPassword
    
  • Explanation: After installing Jenkins, you'll need this password to unlock the Jenkins dashboard for the first time. This command retrieves the initial password from the specified file.

10. Checking the Jenkins Service Status

  • Command:

      service jenkins status
    
  • Explanation: This command checks if Jenkins is running. It should display the current status, indicating whether the service is active or inactive.


Real-Time Scenario: Why Jenkins is Essential

Jenkins automates repetitive tasks like building and deploying code, making it a crucial tool in DevOps for continuous integration and continuous delivery (CI/CD). By installing Jenkins on a server, you enable teams to automatically test and deploy applications across different environments, ensuring faster and more reliable releases.


Key Takeaways

  • Jenkins requires Java (OpenJDK) to run, so make sure Java is installed first.

  • The installation process involves downloading the Jenkins package, installing it, and addressing any dependencies.

  • After installing Jenkins, the initial admin password is needed to access the Jenkins web interface.

  • Regularly check the Jenkins service status to ensure it is running correctly.


🚀Thanks for joining me on Day 48! Let’s keep learning and growing together!

Happy Learning! 😊

#90DaysOfDevOps

💡
Follow for more updates on LinkedIn , Github and Twitter(X)