Operations 19 min read

Master Jenkins: From History to Full CI/CD Setup and Advanced Configuration

This comprehensive guide walks you through Jenkins' origins, explains why it outperforms its predecessor Hudson, and provides step‑by‑step instructions for installing, configuring, securing, and extending Jenkins with pipelines, plugins, user management, and email notifications for robust CI/CD automation.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Jenkins: From History to Full CI/CD Setup and Advanced Configuration

Jenkins Overview

Jenkins is an open‑source automation server written in Java that supports continuous integration (CI) and continuous delivery (CD) through a rich plugin ecosystem.

History

The project originated as Hudson, launched by Sun in 2004. After a trademark dispute following Oracle's acquisition of Sun, the community voted in 2011 to rename the project Jenkins, which has since become the leading CI tool.

Why Jenkins Is Popular

Developed and driven by the community, with most original Hudson contributors moving to Jenkins.

Open governance with an independent board and public input.

Regular long‑term support releases ensure stability.

Over 1,000 plugins cover build, test, deployment, and integration with many tools.

Key Features

CI/CD pipelines

Build automation for Maven, Gradle, Ant, shell scripts

Test automation with JUnit, TestNG

Deployment automation (Docker, Kubernetes)

Monitoring and detailed reporting

Installation

Jenkins can be installed via yum, by downloading the .war file, or using Docker. Example steps for a Red Hat‑based system:

# Remove old Jenkins
rpm -qa | grep jenkins
yum -y remove jenkins
rpm -e jenkins
find / -iname jenkins | xargs rm -rf

# Add Jenkins repo
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat/jenkins.io-2023.key

# Install JDK 11 or 17
yum install fontconfig java-17-openjdk -y
wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.rpm
sudo yum -y install ./jdk-17_linux-x64_bin.rpm
java -version

# Install Jenkins
yum install jenkins -y
systemctl enable jenkins

Start Jenkins with systemctl start jenkins and verify the process is running.

Configuration Files

The main service file /usr/lib/systemd/system/jenkins.service defines the user, environment variables, and ports. Example excerpt:

[Unit]
Description=Jenkins Continuous Integration Server
Requires=network.target
After=network.target

[Service]
Type=notify
NotifyAccess=main
ExecStart=/usr/bin/jenkins
Restart=on-failure
SuccessExitStatus=143
User=root
Group=root
Environment="JENKINS_HOME=/var/lib/jenkins"
WorkingDirectory=/var/lib/jenkins
Environment="JENKINS_WEBROOT=%C/jenkins/war"
Environment="JAVA_OPTS=-Djava.awt.headless=true"
Environment="JENKINS_PORT=3333"

[Install]
WantedBy=multi-user.target

Initial Setup

Retrieve the initial admin password:

cat /var/lib/jenkins/secrets/initialAdminPassword

Install recommended plugins via the web UI, then create the first admin user.

User Management and Role‑Based Access

Install the "Role‑Based Authorization Strategy" and "Authorize Project" plugins to define global, project, and agent roles. Assign users to roles to control permissions such as read, build, and configure.

Parameterized Builds

Enable the "Extended Choice Parameter" and "Git Parameter" plugins to allow users to select branches, versions, and other variables at build time.

Git Integration

Configure Git credentials and ensure the Jenkins user has proper shell access (change the Jenkins user to /bin/bash or add its SSH key to the Git server).

Pipeline Example

A declarative pipeline can pull code, build with Maven, create Docker images, and push them. Example snippet:

pipeline {
    agent any
    parameters {
        string(name: 'version', defaultValue: '2.0.0', description: 'Select version')
        gitParameter(name: 'BRANCH', defaultValue: 'master', type: 'PT_BRANCH', branchFilter: 'origin/(.*)')
    }
    tools { jdk 'jdk1.8'; maven 'maven-3.9.6' }
    stages {
        stage('pull code') {
            steps {
                cleanWs()
                git branch: "${params.BRANCH}", credentialsId: 'git-cred', url: '[email protected]/repo.git'
            }
        }
        stage('build') {
            steps {
                sh "mvn clean install -DskipTests"
            }
        }
        // Additional stages for Docker build, push, etc.
    }
}

Email Notifications

Install the "Email Extension Plugin" and configure SMTP settings under "Manage Jenkins → Configure System". Test the configuration by sending a test email.

After configuration, Jenkins can send build status emails to the specified recipients.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Dockerci/cdKubernetesDevOpsPipelineJenkins
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.