Jenkins Guide and Installation

Jenkins Guide and Installation

Jenkins is an Open Source project written on "JAVA" that runs on Windows, macOS & Other Os. It's completely free, community support runs on port 8080 and might be your first choice tool for CI.

  • It automates the entire software development life cycle

  • Jenkins was originally developed by "Sun Microsystem in 2004" under the name Hudson and later names Jenkins when Oracle acquires the microsystem.

  • After the oracle revokes Jenkins from Hudson which is Jenkins free while Hudson is enterprise

  • IT can run on any major platform without any compatibility issues.

  • The developer writes code and integrates all that code of all developers at any point in time, we build, test, and deploy to the client this is called CI/CD

  • Jenkins CI, now bugs will be reported fast & rectified foot.

Workflow of Jenkins

  1. We can attach git, Maven, Selenum & Artifactory plugins to Jenkins.

  2. Once developers push code to GitHub, Jenkins pulls that and builds a workspace for that particular code as /var/bin/workspace path.

  3. From that workspace, the CI process is completed next to deployment or delivery.

Installation of Jenkins in Ubuntu 22.04

  • Update your system
sudo apt-get update -y
  • For the installation of Jenkins, we need to install JDK first as Jenkins belongs to JAVA so JDK 11 will be required
sudo apt install openjdk-17-jre
  • Now validate JAVA
java -version

It should like something

openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment
(build 11.0.12+7-post-Debian-2) OpenJDK 64-Bit Server VM (build 
11.0.12+7-post-Debian-2, mixed mode, sharing)
  • Install Jenkins

    The version of Jenkins included with the default Ubuntu packages is often behind the latest available version from the project itself. To ensure you have the latest fixes and features, use the project-maintained packages to install Jenkins.

    First, add the repository key to the system:

  • Next Debian packages from the repository server

      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
    

After both commands executed succesfully now make the system update and install Jenkins

sudo apt-get update

sudo apt-get install jenkins -y
  • Now Jenkins has been installed on the Ubuntu machine we need to check the status and start the Jenkins

      sudo systemctl start jenkins
    
      sudo systemctl status jenkins
    

    If everything went well, the beginning of the status output shows that the service is active and configured to start at boot:

Some more steps in case any dependencies came up to launch Jenkins

To set up a UFW firewall, visit Initial Server Setup with Ubuntu 20.04, Step 4- Setting up a Basic Firewall. By default, Jenkins runs on port 8080. We’ll open that port using ufw

sudo ufw allow 8080
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status

The final step into Jenkins

To set up your installation, visit Jenkins on its default port, 8080, using your server domain name or IP address: http://your_server_ip_or_domain:8080

You should receive the Unlock Jenkins screen, which displays the location of the initial password:

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

Here if you're installing Jenkins for the first time then would recommend you choose the suggested plugins first.

Here is your Jenkins first home dashboard...and enjoy :)

The next blog will be uploaded soon..........!