+
gulp
eslint
<=
+
+
$
qdrant
+
+
++
bbedit
+
+
+
+
hapi
eslint
ocaml
cassandra
php
+
+
+
postgres
+
+
py
c++
+
android
objc
+
lisp
+
s3
mint
ubuntu
+
kotlin
matplotlib
+
actix
+
laravel
pascal
apex
+
+
cdn
+
fiber
+
qdrant
+
sse
+
sqlite
+
vb
+
+
+
c++
suse
gentoo
+
dynamo
+
+
+
+
+
+
+
+
jasmine
android
+
jasmine
โˆ‚
+
f#
+
!==
+
+
+
+
+
Back to Blog
AlmaLinux Jenkins CI/CD

๐Ÿš€ Mastering Jenkins CI/CD on AlmaLinux: Automate Your Development Pipeline Like a DevOps Pro

Published Aug 22, 2025

Learn how to install, configure, and master Jenkins CI/CD pipelines on AlmaLinux. From basic setup to advanced automation, become a DevOps expert with this comprehensive guide!

5 min read
0 views
Table of Contents

๐Ÿš€ Mastering Jenkins CI/CD on AlmaLinux: Automate Your Development Pipeline Like a DevOps Pro

Hey there, automation enthusiast! ๐ŸŽฏ Ready to join the DevOps revolution? You know that feeling when youโ€™re manually building, testing, and deploying code over and over again? Itโ€™s exhausting, right? Well, today weโ€™re going to set up Jenkins on AlmaLinux and automate ALL of that!

I still remember my first Jenkins pipeline - what used to take me hours of manual work suddenly happened automatically with just a git push! ๐ŸŽ‰ It felt like magic, and honestly, it changed my entire approach to software development. By the end of this guide, youโ€™ll have your own CI/CD pipeline running, and trust me, youโ€™ll wonder how you ever lived without it!

๐Ÿค” Why is Jenkins CI/CD Important?

Jenkins is the superhero of automation! ๐Ÿฆธโ€โ™‚๏ธ Let me show you why every development team needs it:

The Power of Jenkins:

  • ๐Ÿ”„ Continuous Integration - Automatically build and test every code change
  • ๐Ÿšข Continuous Deployment - Deploy to production with confidence
  • ๐Ÿ› Early Bug Detection - Catch issues before they reach production
  • โฐ Save Time - Automate repetitive tasks and focus on coding
  • ๐Ÿ“Š Quality Gates - Enforce code standards automatically
  • ๐Ÿ”ง Extensible Platform - Thousands of plugins for every need
  • ๐Ÿ‘ฅ Team Collaboration - Everyone sees build status in real-time
  • ๐Ÿ“ˆ Faster Delivery - Ship features to users quickly and safely

๐ŸŽฏ What You Need

Before we automate everything, letโ€™s check our toolkit! ๐Ÿ› ๏ธ Hereโ€™s what youโ€™ll need:

Prerequisites:

  • โœ… AlmaLinux 8 or 9 installed and running
  • โœ… Root or sudo access (we need admin powers!)
  • โœ… At least 2GB RAM (4GB recommended)
  • โœ… 10GB free disk space minimum
  • โœ… Java 11 or higher (weโ€™ll install it!)
  • โœ… Basic Git knowledge (helpful but not required)
  • โœ… About 60 minutes of your time
  • โœ… Excitement to automate everything! ๐ŸŽ‰

๐Ÿ“ Step 1: Installing Java and Prerequisites

Jenkins needs Java to run, so letโ€™s set that up first! โ˜• Think of Java as the engine that powers Jenkins.

Install Java and Dependencies:

# Update your system packages first
sudo dnf update -y

# Install Java 11 (OpenJDK)
sudo dnf install java-11-openjdk java-11-openjdk-devel -y

# Verify Java installation
java -version
# Output: openjdk version "11.0.x" - Perfect! โ˜•

# Set JAVA_HOME environment variable
echo 'export JAVA_HOME=/usr/lib/jvm/java-11-openjdk' | sudo tee -a /etc/profile
echo 'export PATH=$PATH:$JAVA_HOME/bin' | sudo tee -a /etc/profile

# Reload profile
source /etc/profile

# Verify JAVA_HOME
echo $JAVA_HOME
# Should show: /usr/lib/jvm/java-11-openjdk

# Install additional tools we'll need
sudo dnf install git wget curl -y

Configure System Requirements:

# Increase file limits for Jenkins
sudo tee -a /etc/security/limits.conf << EOF
jenkins soft nofile 65536
jenkins hard nofile 65536
jenkins soft nproc 32768
jenkins hard nproc 32768
EOF

# Create Jenkins user (will be done by package, but good to know)
# sudo useradd -m -s /bin/bash jenkins

# Check system resources
free -h  # Check RAM
df -h    # Check disk space
nproc    # Check CPU cores

๐Ÿ”ง Step 2: Installing Jenkins

Time to install Jenkins itself! ๐ŸŽฏ This is where the magic begins.

Add Jenkins Repository and Install:

# Import Jenkins GPG key
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key

# Add Jenkins repository
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo

# Install Jenkins
sudo dnf install jenkins -y

# Enable Jenkins to start on boot
sudo systemctl enable jenkins

# Start Jenkins service
sudo systemctl start jenkins

# Check Jenkins status
sudo systemctl status jenkins
# Output: Active (running) - Awesome! ๐Ÿš€

# Get initial admin password (save this!)
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
# Copy this password - you'll need it! ๐Ÿ”

Configure Firewall:

# Open Jenkins port (8080)
sudo firewall-cmd --permanent --add-port=8080/tcp

# If you'll use build agents, open JNLP port
sudo firewall-cmd --permanent --add-port=50000/tcp

# Reload firewall
sudo firewall-cmd --reload

# Verify ports are open
sudo firewall-cmd --list-ports
# Should show: 8080/tcp 50000/tcp

๐ŸŒŸ Step 3: Initial Jenkins Setup

Letโ€™s configure Jenkins through the web interface! ๐Ÿ–ฅ๏ธ This is where it gets exciting!

Access Jenkins Web Interface:

# Get your server IP
ip addr show | grep "inet "
# Note your IP address (e.g., 192.168.1.100)

# Open browser and navigate to:
# http://YOUR_SERVER_IP:8080

# You'll see "Unlock Jenkins" screen
# Paste the initial admin password we saved earlier

Complete Setup Wizard:

# After unlocking, you'll see plugin installation options
# Choose "Install suggested plugins" - this installs essentials!

# Plugins being installed:
# - Git plugin (for version control)
# - Pipeline plugin (for CI/CD pipelines)
# - Credentials plugin (for secure storage)
# - And many more! 

# Create your admin user:
# Username: admin
# Password: [Choose strong password]
# Full name: Jenkins Admin
# Email: [email protected]

# Configure Jenkins URL:
# http://YOUR_SERVER_IP:8080/

# Click "Save and Finish"
# Then "Start using Jenkins" ๐ŸŽ‰

Install Additional Useful Plugins:

# In Jenkins web interface:
# Go to: Manage Jenkins โ†’ Manage Plugins โ†’ Available

# Search and install these essential plugins:
# โœ… Blue Ocean (modern UI for pipelines)
# โœ… Docker Pipeline (if using Docker)
# โœ… Slack Notification (for team alerts)
# โœ… Email Extension (advanced email notifications)
# โœ… Build Timestamp (add timestamps to builds)
# โœ… AnsiColor (colorful console output)

# Click "Install without restart"
# Then check "Restart Jenkins when installation is complete"

โœ… Step 4: Creating Your First Pipeline

Letโ€™s create a real CI/CD pipeline! ๐Ÿš€ This is where the automation magic happens!

Create a Simple Pipeline Job:

# First, let's create a sample project locally
mkdir ~/jenkins-demo
cd ~/jenkins-demo

# Create a simple Node.js application
cat > app.js << 'EOF'
const http = require('http');

const server = http.createServer((req, res) => {
    res.writeHead(200, {'Content-Type': 'text/html'});
    res.end('<h1>Hello from Jenkins CI/CD! ๐Ÿš€</h1>');
});

server.listen(3000, () => {
    console.log('Server running on port 3000');
});
EOF

# Create package.json
cat > package.json << 'EOF'
{
  "name": "jenkins-demo",
  "version": "1.0.0",
  "scripts": {
    "start": "node app.js",
    "test": "echo 'Tests passed! โœ…' && exit 0"
  }
}
EOF

# Create Jenkinsfile (pipeline definition)
cat > Jenkinsfile << 'EOF'
pipeline {
    agent any
    
    stages {
        stage('Checkout') {
            steps {
                echo '๐Ÿ“ฅ Checking out code...'
                checkout scm
            }
        }
        
        stage('Install Dependencies') {
            steps {
                echo '๐Ÿ“ฆ Installing dependencies...'
                sh 'npm install'
            }
        }
        
        stage('Run Tests') {
            steps {
                echo '๐Ÿงช Running tests...'
                sh 'npm test'
            }
        }
        
        stage('Build') {
            steps {
                echo '๐Ÿ”จ Building application...'
                sh 'echo "Build completed successfully!"'
            }
        }
        
        stage('Deploy') {
            steps {
                echo '๐Ÿš€ Deploying to server...'
                sh 'echo "Deployment simulation - SUCCESS!"'
            }
        }
    }
    
    post {
        success {
            echo 'โœ… Pipeline completed successfully!'
        }
        failure {
            echo 'โŒ Pipeline failed. Please check the logs.'
        }
    }
}
EOF

# Initialize git repository
git init
git add .
git commit -m "Initial commit ๐ŸŽ‰"

Configure Pipeline in Jenkins:

// In Jenkins Web UI:
// 1. Click "New Item"
// 2. Enter name: "my-first-pipeline"
// 3. Select "Pipeline" โ†’ OK

// In Pipeline configuration:
// Definition: Pipeline script
// Add this script:

pipeline {
    agent any
    
    environment {
        APP_NAME = 'Jenkins Demo App'
        BUILD_NUMBER = "${env.BUILD_NUMBER}"
    }
    
    stages {
        stage('Preparation') {
            steps {
                echo "๐ŸŽฏ Starting build #${BUILD_NUMBER} for ${APP_NAME}"
                sh 'echo "Workspace: $(pwd)"'
            }
        }
        
        stage('Code Quality') {
            steps {
                echo '๐Ÿ“Š Checking code quality...'
                sh '''
                    echo "Running linting..."
                    echo "Code quality check passed! โœ…"
                '''
            }
        }
        
        stage('Security Scan') {
            steps {
                echo '๐Ÿ”’ Running security scan...'
                sh '''
                    echo "Scanning for vulnerabilities..."
                    echo "No vulnerabilities found! ๐Ÿ›ก๏ธ"
                '''
            }
        }
        
        stage('Build Docker Image') {
            steps {
                echo '๐Ÿณ Building Docker image...'
                sh '''
                    echo "docker build -t ${APP_NAME}:${BUILD_NUMBER} ."
                    echo "Image built successfully!"
                '''
            }
        }
        
        stage('Deploy to Staging') {
            steps {
                echo '๐ŸŽฌ Deploying to staging environment...'
                sh '''
                    echo "Deploying version ${BUILD_NUMBER} to staging"
                    sleep 2
                    echo "Staging deployment complete! ๐ŸŒŸ"
                '''
            }
        }
        
        stage('Run Integration Tests') {
            steps {
                echo '๐Ÿงช Running integration tests...'
                sh '''
                    echo "Testing API endpoints..."
                    echo "Testing database connections..."
                    echo "All integration tests passed! โœ…"
                '''
            }
        }
        
        stage('Deploy to Production') {
            when {
                branch 'main'
            }
            steps {
                echo '๐Ÿš€ Deploying to production...'
                input message: 'Deploy to production?', ok: 'Deploy!'
                sh '''
                    echo "Deploying to production servers..."
                    echo "Production deployment successful! ๐ŸŽ‰"
                '''
            }
        }
    }
    
    post {
        always {
            echo '๐Ÿ“Š Generating reports...'
        }
        success {
            echo 'โœ… Build successful! Great job! ๐ŸŽŠ'
        }
        failure {
            echo 'โŒ Build failed. Check the logs for details.'
        }
    }
}

// Save and click "Build Now"!

๐ŸŽฎ Quick Examples

Letโ€™s create some practical Jenkins pipelines! ๐Ÿš€

Example 1: Python Application Pipeline

// Create a Python CI/CD pipeline
pipeline {
    agent any
    
    stages {
        stage('Setup Python Environment') {
            steps {
                sh '''
                    echo "๐Ÿ Setting up Python environment..."
                    python3 -m venv venv
                    source venv/bin/activate
                    pip install --upgrade pip
                '''
            }
        }
        
        stage('Install Dependencies') {
            steps {
                sh '''
                    source venv/bin/activate
                    pip install -r requirements.txt
                '''
            }
        }
        
        stage('Run Unit Tests') {
            steps {
                sh '''
                    source venv/bin/activate
                    python -m pytest tests/ -v
                '''
            }
        }
        
        stage('Code Coverage') {
            steps {
                sh '''
                    source venv/bin/activate
                    coverage run -m pytest
                    coverage report
                '''
            }
        }
    }
}

Example 2: Automated Backup Pipeline

// Scheduled backup pipeline
pipeline {
    agent any
    
    triggers {
        // Run daily at 2 AM
        cron('0 2 * * *')
    }
    
    stages {
        stage('Backup Database') {
            steps {
                sh '''
                    echo "๐Ÿ’พ Starting database backup..."
                    DATE=$(date +%Y%m%d_%H%M%S)
                    mysqldump -u root myapp > backup_${DATE}.sql
                    gzip backup_${DATE}.sql
                    echo "Database backup completed!"
                '''
            }
        }
        
        stage('Backup Files') {
            steps {
                sh '''
                    echo "๐Ÿ“ Backing up application files..."
                    tar -czf app_backup_$(date +%Y%m%d).tar.gz /var/www/html/
                    echo "File backup completed!"
                '''
            }
        }
        
        stage('Upload to Cloud') {
            steps {
                sh '''
                    echo "โ˜๏ธ Uploading to cloud storage..."
                    # aws s3 cp backup_*.gz s3://my-backup-bucket/
                    echo "Upload completed!"
                '''
            }
        }
    }
}

Example 3: Multi-Branch Pipeline

// Jenkinsfile for multi-branch pipeline
pipeline {
    agent any
    
    stages {
        stage('Build') {
            steps {
                echo "Building branch: ${env.BRANCH_NAME}"
                sh 'make build'
            }
        }
        
        stage('Test') {
            parallel {
                stage('Unit Tests') {
                    steps {
                        sh 'make test-unit'
                    }
                }
                stage('Integration Tests') {
                    steps {
                        sh 'make test-integration'
                    }
                }
                stage('Lint') {
                    steps {
                        sh 'make lint'
                    }
                }
            }
        }
        
        stage('Deploy') {
            when {
                anyOf {
                    branch 'main'
                    branch 'develop'
                }
            }
            steps {
                script {
                    if (env.BRANCH_NAME == 'main') {
                        echo '๐Ÿš€ Deploying to production...'
                        sh 'make deploy-prod'
                    } else {
                        echo '๐ŸŽฌ Deploying to staging...'
                        sh 'make deploy-staging'
                    }
                }
            }
        }
    }
}

๐Ÿšจ Fix Common Problems

Donโ€™t worry if you hit some bumps! Here are solutions to common Jenkins issues:

Problem 1: Jenkins Wonโ€™t Start

# Check Jenkins logs
sudo journalctl -u jenkins -n 50

# Common fix: Java version issue
java -version  # Should be 11 or higher

# If wrong Java version, switch it
sudo alternatives --config java
# Select Java 11

# Check port 8080 is free
sudo netstat -tulpn | grep :8080

# If port is taken, change Jenkins port
sudo nano /etc/sysconfig/jenkins
# Change: JENKINS_PORT="8081"

# Restart Jenkins
sudo systemctl restart jenkins

Problem 2: Pipeline Fails with Permission Errors

# Jenkins user needs permissions
sudo usermod -aG docker jenkins  # If using Docker
sudo usermod -aG wheel jenkins   # For sudo access

# Fix workspace permissions
sudo chown -R jenkins:jenkins /var/lib/jenkins/workspace/

# SELinux might be blocking
sudo setenforce 0  # Temporarily disable to test

# If that fixes it, configure SELinux properly:
sudo setsebool -P httpd_can_network_connect 1
sudo setenforce 1

Problem 3: Canโ€™t Connect to Git Repository

# Generate SSH key for Jenkins
sudo -u jenkins ssh-keygen -t rsa -b 4096

# Get public key
sudo cat /var/lib/jenkins/.ssh/id_rsa.pub
# Add this to your Git repository

# Test Git connection
sudo -u jenkins git ls-remote [email protected]:user/repo.git

# Configure Git globally for Jenkins
sudo -u jenkins git config --global user.name "Jenkins"
sudo -u jenkins git config --global user.email "[email protected]"

๐Ÿ“‹ Simple Commands Summary

Your Jenkins command reference! ๐Ÿ“š Keep this handy:

TaskCommandWhat It Does
Start Jenkinssudo systemctl start jenkinsStarts Jenkins service ๐Ÿš€
Stop Jenkinssudo systemctl stop jenkinsStops Jenkins service ๐Ÿ›‘
Restart Jenkinssudo systemctl restart jenkinsRestarts Jenkins ๐Ÿ”„
Check Statussudo systemctl status jenkinsShows if running โœ…
View Logssudo journalctl -u jenkins -fLive log viewing ๐Ÿ“
Get Admin Passwordsudo cat /var/lib/jenkins/secrets/initialAdminPasswordInitial setup ๐Ÿ”
Jenkins CLIjava -jar jenkins-cli.jar -s http://localhost:8080/Command line access ๐Ÿ’ป
Backup Jenkinstar -czf jenkins-backup.tar.gz /var/lib/jenkins/Backup everything ๐Ÿ’พ
Check Versionjenkins --versionShows Jenkins version ๐Ÿ“Š
Safe Restarthttp://YOUR_IP:8080/safeRestartGraceful restart ๐Ÿ”„
Plugin Listls /var/lib/jenkins/plugins/Installed plugins ๐Ÿ”Œ
Clear Cacherm -rf /var/lib/jenkins/cache/*Clear Jenkins cache ๐Ÿงน

๐Ÿ’ก Tips for Success

Here are my pro tips for Jenkins mastery! ๐ŸŽฏ

Best Practices:

  • ๐Ÿ”’ Secure Jenkins - Use HTTPS, strong passwords, and limit access
  • ๐Ÿ’พ Regular Backups - Backup Jenkins home directory weekly
  • ๐Ÿ“Š Monitor Resources - Jenkins can be memory-hungry
  • ๐Ÿ”Œ Choose Plugins Wisely - Too many plugins slow things down
  • ๐Ÿ“ Use Pipeline as Code - Store Jenkinsfiles in version control
  • ๐Ÿงช Test Pipelines - Use replay feature to test changes
  • ๐Ÿ”„ Clean Workspaces - Regular cleanup saves disk space
  • ๐Ÿ“ˆ Monitor Build Times - Optimize slow stages

Performance Optimization:

  • โšก Use Build Agents - Distribute load across multiple machines
  • ๐Ÿš€ Parallel Execution - Run independent stages simultaneously
  • ๐Ÿ’พ Cache Dependencies - Donโ€™t download same files repeatedly
  • ๐ŸŽฏ Incremental Builds - Only build what changed
  • ๐Ÿ”ง Tune JVM Settings - Adjust memory allocation for Jenkins
  • ๐Ÿ“ฆ Archive Selectively - Donโ€™t archive everything

๐Ÿ† What You Learned

Amazing job! Look at what youโ€™ve mastered! ๐ŸŽŠ

Your Achievements:

  • โœ… Installed Jenkins on AlmaLinux
  • โœ… Configured initial security settings
  • โœ… Created your first CI/CD pipeline
  • โœ… Learned Pipeline as Code syntax
  • โœ… Set up automated builds and tests
  • โœ… Configured deployment stages
  • โœ… Mastered parallel execution
  • โœ… Implemented best practices
  • โœ… Troubleshot common issues
  • โœ… Became a DevOps practitioner!

๐ŸŽฏ Why This Matters

Your Jenkins server is transforming how you develop software! ๐Ÿš€

With Jenkins CI/CD, you can now:

  • ๐Ÿ”„ Automate Everything - From builds to deployments
  • ๐Ÿ› Catch Bugs Early - Before they reach production
  • ๐Ÿšข Ship Faster - Deploy multiple times per day
  • ๐Ÿ“Š Ensure Quality - Automated testing on every change
  • ๐Ÿ‘ฅ Improve Collaboration - Everyone sees build status
  • ๐Ÿ’ฐ Save Money - Reduce manual testing costs
  • ๐ŸŽฏ Focus on Code - Let Jenkins handle the repetitive stuff
  • ๐ŸŒŸ Build Confidence - Know your code works before deploying

Remember when you were doing everything manually? Now you have a powerful automation server that works 24/7, never gets tired, and catches issues instantly! Youโ€™ve joined the ranks of DevOps professionals who ship quality code continuously! ๐ŸŒŸ

Keep automating, keep improving, and most importantly, enjoy your newfound DevOps superpowers! ๐Ÿฆธโ€โ™‚๏ธ

Happy automating, and welcome to the world of CI/CD excellence! ๐Ÿ™Œ


P.S. - Donโ€™t forget to secure your Jenkins instance before using it in production. Security first! โญ