Inspirational journeys

Follow the stories of academics and their research expeditions

Jenkins Pipeline: A Step-by-Step Guide

Eduvoxy Admin

Thu, 09 Jan 2025

Jenkins Pipeline: A Step-by-Step Guide How to Download, Install, and Configure Jenkins Pipeline: A Step-by-Step Guide

How to Download, Install, and Configure Jenkins Pipeline: A Step-by-Step Guide

Jenkins is a popular open-source automation server used to build, test, and deploy applications. In this guide, we will walk you through the process of downloading, installing, and configuring Jenkins Pipeline. We will also cover how to configure plugins, global settings, credentials, and GitHub integration. Let's get started!

Step 1: Download Jenkins

  • Visit the Jenkins Website

    Go to the Jenkins official website.

  • Download Jenkins

    Click on the "Download" button. Choose your operating system (Windows, macOS, Linux) and download the appropriate installer.

Step 2: Install Jenkins

  • Run the Installer

    For Windows: Double-click the downloaded .exe file and follow the installation wizard.

    For macOS: Open the downloaded .pkg file and follow the installation instructions.

    For Linux: Use the package manager to install Jenkins. For example, on Ubuntu:

    sudo apt update
    sudo apt install jenkins
  • Start Jenkins

    Once installed, start the Jenkins service.

    On Windows: Jenkins usually starts automatically. If not, find Jenkins in the Services app and start it.

    On macOS and Linux: Use the command:

    sudo systemctl start jenkins
  • Access Jenkins

    Open a web browser and navigate to http://localhost:8080. You will see the Jenkins unlock screen.

Step 3: Unlock Jenkins

  • Find the Initial Admin Password

    Locate the initial admin password. This is usually found in a file on your system.

    For Windows: Check the C:\Program Files (x86)\Jenkins\secrets\initialAdminPassword file.

    For macOS and Linux: Check the /var/lib/jenkins/secrets/initialAdminPassword file.

  • Enter the Password

    Copy the password from the file and paste it into the Jenkins unlock screen. Click "Continue."

Step 4: Install Suggested Plugins

  • Install Plugins

    Jenkins will prompt you to install suggested plugins. Click on "Install suggested plugins." Jenkins will start installing the necessary plugins. This may take a few minutes.

Step 5: Configure Jenkins

  • Create an Admin User

    Once the plugins are installed, you will be asked to create your first admin user. Fill in the required details and click "Save and Finish."

  • Instance Configuration

    Jenkins will ask you to confirm the Jenkins URL. Leave it as default (http://localhost:8080) and click "Save and Finish."

Step 6: Configure Plugins

  • Manage Jenkins

    From the Jenkins dashboard, click on "Manage Jenkins."

  • Manage Plugins

    Click on "Manage Plugins." Go to the "Available" tab to see the list of available plugins. Use the search bar to find plugins you need (e.g., "Pipeline," "GitHub"). Select the plugins and click "Install without restart."

Step 7: Configure Global Settings

  • Global Tool Configuration

    Go to "Manage Jenkins" -> "Global Tool configuration." Configure tools such as JDK, Git, and Maven by specifying their locations. Click "Save" when done.

Step 8: Configure Credentials

  • Manage Credentials

    From the Jenkins dashboard, click on "Manage Jenkins" -> "Manage Credentials."

  • Add Credentials

    Select the domain (e.g., Global) where you want to add credentials. Click on "Add Credentials." Enter the required information (e.g., username, password, secret text) and click "OK."

Step 9: Configure GitHub Credentials

  • Add GitHub Credentials

    Follow the same steps as in Step 8, but choose "GitHub" as the credential type. Enter your GitHub username and personal access token. Click "OK."

Step 10: Create and Configure a Pipeline

  • Create a New Job

    From the Jenkins dashboard, click on "New Item." Enter a name for your job, select "Pipeline," and click "OK."

  • Configure the Pipeline

    In the job configuration page, scroll down to the "Pipeline" section. Select "Pipeline script from SCM" if you want to use a script from your version control system. Choose "Git" as the SCM and enter your repository URL. Select the credentials you added earlier.

  • Pipeline Script

    If you choose to write the script directly in Jenkins, select "Pipeline script" and enter your script in the text area. Here's an example:

    pipeline {
        agent any
        stages {
            stage('Build') {
                steps {
                    echo 'Building...'
                }
            }
            stage('Test') {
                steps {
                    echo 'Testing...'
                }
            }
            stage('Deploy') {
                steps {
                    echo 'Deploying...'
                }
            }
        }
    }

    Click "Save."

    Step 11: Run the Pipeline

    • Build Now

      Go to the job dashboard and click on "Build Now." Jenkins will start running your pipeline. You can view the progress and logs in the console output.

0 Comments

Leave a comment