vercel
dart
+
py
rs
aws
+
+
ray
fiber
+
+
+
xcode
saml
jquery
actix
^
+
vb
+
+
+
+
+
+
โˆš
+
+
+
+
r
puppet
+
!==
prometheus
+
+
php
nest
echo
+
graphql
+
+
redis
spacy
+
+
laravel
+
+
mocha
gh
vault
ember
+
+
+
gin
+
cassandra
โˆž
+
+
+
+
+
+
java
elixir
grafana
+
rs
+
+
+
!!
{}
+
+
+
+
xml
+
+
+
+
arch
+
Back to Blog
๐Ÿš€ Jenkins CI/CD Server on AlmaLinux: Automate Your Software Delivery Pipeline
jenkins cicd almalinux

๐Ÿš€ Jenkins CI/CD Server on AlmaLinux: Automate Your Software Delivery Pipeline

Published Sep 6, 2025

Master Jenkins on AlmaLinux! Learn installation, pipeline creation, job configuration, and continuous integration. Perfect automation server for DevOps workflows!

5 min read
0 views
Table of Contents

๐Ÿš€ Jenkins CI/CD Server on AlmaLinux: Automate Your Software Delivery Pipeline

Welcome to the world of continuous integration and delivery! ๐ŸŽ‰ Ready to automate your entire software pipeline? Jenkins is the most popular open-source automation server that makes CI/CD a breeze! Itโ€™s the platform that transforms manual deployments into automated workflows! Think of it as your development teamโ€™s best friend that never sleeps! ๐Ÿš€โœจ

๐Ÿค” Why is Jenkins Important?

Jenkins revolutionizes software delivery! ๐Ÿš€ Hereโ€™s why itโ€™s amazing:

  • ๐Ÿ”„ Continuous Integration - Automatically build and test code!
  • ๐Ÿ“ฆ Continuous Delivery - Deploy to production seamlessly!
  • ๐Ÿ”Œ 1000+ Plugins - Integrate with everything!
  • ๐Ÿ“Š Pipeline as Code - Version control your workflows!
  • ๐ŸŽฏ Distributed Builds - Scale across multiple machines!
  • ๐Ÿ†“ Completely Free - Open source forever!

Itโ€™s like having a robot army for your deployments! ๐Ÿ’ฐ

๐ŸŽฏ What You Need

Before building your CI/CD pipeline, ensure you have:

  • โœ… AlmaLinux 9 server
  • โœ… Root or sudo access
  • โœ… At least 2GB RAM (4GB recommended)
  • โœ… 2 CPU cores minimum
  • โœ… 10GB free disk space
  • โœ… Java 11 or newer
  • โœ… Love for automation! ๐Ÿš€

๐Ÿ“ Step 1: System Preparation - Getting Ready!

Letโ€™s prepare AlmaLinux 9 for Jenkins! ๐Ÿ—๏ธ

# Update system packages
sudo dnf update -y

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

# Verify Java installation
java -version
# Should show: openjdk version "11.0.x"

# Set JAVA_HOME environment variable
echo 'export JAVA_HOME=/usr/lib/jvm/java-11-openjdk' >> ~/.bashrc
echo 'export PATH=$JAVA_HOME/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

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

# Install additional tools
sudo dnf install -y wget git curl unzip

Configure firewall for Jenkins:

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

# Verify port is open
sudo firewall-cmd --list-ports
# Should show: 8080/tcp

Perfect! System is ready! ๐ŸŽฏ

๐Ÿ”ง Step 2: Installing Jenkins - The Official Way!

Letโ€™s install Jenkins from the official repository! ๐Ÿš€

Add Jenkins Repository:

# 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

# Verify repository
sudo dnf repolist | grep jenkins
# Should show: jenkins repository

Install Jenkins:

# Install Jenkins
sudo dnf install -y jenkins

# Enable Jenkins service
sudo systemctl enable jenkins

# Start Jenkins
sudo systemctl start jenkins

# Check status
sudo systemctl status jenkins
# Should show: active (running)

# View initial admin password
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
# Save this password! You'll need it!

๐ŸŒŸ Step 3: Initial Setup - Your CI/CD Dashboard!

Time to configure Jenkins! ๐ŸŽฎ

Access Jenkins Web UI:

# Get your server IP
ip addr show | grep inet
# Note your server IP address

# Access Jenkins
# URL: http://your-server-ip:8080
# Enter the initial admin password from earlier

Setup Wizard Steps:

  1. Unlock Jenkins:

    • Enter initial admin password
    • Click โ€œContinueโ€
  2. Install Plugins:

    • Select โ€œInstall suggested pluginsโ€
    • Wait for plugins to install (5-10 minutes)
    • Plugins include Git, Pipeline, Credentials, etc.
  3. Create Admin User:

    • Username: admin
    • Password: YourSecurePassword
    • Full name: Jenkins Admin
    • Email: [email protected]
  4. Instance Configuration:

    • Jenkins URL: http://your-server-ip:8080
    • Click โ€œSave and Finishโ€
  5. Start Using Jenkins! ๐ŸŽ‰

Dashboard shows:

  • ๐Ÿ“Š New Item - Create jobs/pipelines
  • ๐Ÿ‘ฅ People - User management
  • ๐Ÿ“ˆ Build History - Execution logs
  • ๐Ÿ”ง Manage Jenkins - Configuration
  • ๐Ÿ“š My Views - Custom dashboards

โœ… Step 4: Creating Your First Pipeline - Letโ€™s Build!

Time to create your first CI/CD pipeline! ๐ŸŽฏ

Create Freestyle Project:

  1. Click โ€œNew Itemโ€
  2. Enter name: Hello-World-Build
  3. Select: โ€œFreestyle projectโ€
  4. Click โ€œOKโ€

Configure Build:

  1. General Section:

    • Description: My first Jenkins build
    • Check: โ€œDiscard old buildsโ€
    • Max builds: 10
  2. Source Code Management:

    • Select: โ€œGitโ€
    • Repository URL: https://github.com/example/hello-world.git
    • Branch: */main
  3. Build Triggers:

    • Check: โ€œPoll SCMโ€
    • Schedule: H/5 * * * * (every 5 minutes)
  4. Build Steps:

    • Click โ€œAdd build stepโ€ โ†’ โ€œExecute shellโ€
    echo "=== Starting Build ==="
    echo "Build number: $BUILD_NUMBER"
    echo "Workspace: $WORKSPACE"
    
    # Example build commands
    echo "Running tests..."
    # npm test
    
    echo "Building application..."
    # npm run build
    
    echo "Build completed successfully!"
  5. Save the job

Run the Build:

  1. Click โ€œBuild Nowโ€ ๐Ÿš€
  2. Watch build progress in Build History
  3. Click build number for details
  4. View โ€œConsole Outputโ€ for logs

๐ŸŒŸ Step 5: Creating Pipeline as Code - Modern CI/CD!

Letโ€™s create a declarative pipeline! ๐ŸŽฏ

Create Pipeline Job:

  1. New Item โ†’ Name: Application-Pipeline
  2. Select: โ€œPipelineโ€
  3. Click โ€œOKโ€

Write Jenkinsfile:

In Pipeline section, add:

pipeline {
    agent any
    
    environment {
        APP_NAME = 'MyApp'
        APP_VERSION = '1.0.0'
    }
    
    stages {
        stage('Checkout') {
            steps {
                echo '=== Checking out code ==='
                git branch: 'main', 
                    url: 'https://github.com/example/myapp.git'
            }
        }
        
        stage('Build') {
            steps {
                echo '=== Building application ==='
                sh '''
                    echo "Building ${APP_NAME} version ${APP_VERSION}"
                    # npm install
                    # npm run build
                '''
            }
        }
        
        stage('Test') {
            steps {
                echo '=== Running tests ==='
                sh '''
                    echo "Testing application..."
                    # npm test
                    # npm run test:coverage
                '''
            }
        }
        
        stage('Deploy to Staging') {
            steps {
                echo '=== Deploying to staging ==='
                sh '''
                    echo "Deploying to staging server..."
                    # scp -r dist/* user@staging:/var/www/
                    # ssh user@staging "sudo systemctl restart app"
                '''
            }
        }
        
        stage('Approval') {
            steps {
                input message: 'Deploy to production?', 
                      ok: 'Deploy'
            }
        }
        
        stage('Deploy to Production') {
            steps {
                echo '=== Deploying to production ==='
                sh '''
                    echo "Deploying to production..."
                    # scp -r dist/* user@prod:/var/www/
                    # ssh user@prod "sudo systemctl restart app"
                '''
            }
        }
    }
    
    post {
        success {
            echo 'Pipeline completed successfully!'
            // Send success notification
        }
        failure {
            echo 'Pipeline failed!'
            // Send failure alert
        }
        always {
            echo 'Cleaning up workspace...'
            cleanWs()
        }
    }
}

Save and Run Pipeline:

  1. Save the pipeline
  2. Click โ€œBuild Nowโ€
  3. Watch stages execute in Stage View
  4. Approve deployment when prompted

๐ŸŽฎ Quick Examples

Example 1: Docker Build Pipeline

pipeline {
    agent any
    
    stages {
        stage('Build Docker Image') {
            steps {
                script {
                    docker.build("myapp:${env.BUILD_NUMBER}")
                }
            }
        }
        
        stage('Push to Registry') {
            steps {
                script {
                    docker.withRegistry('https://registry.example.com', 'docker-creds') {
                        docker.image("myapp:${env.BUILD_NUMBER}").push()
                        docker.image("myapp:${env.BUILD_NUMBER}").push('latest')
                    }
                }
            }
        }
        
        stage('Deploy Container') {
            steps {
                sh '''
                    docker stop myapp || true
                    docker rm myapp || true
                    docker run -d --name myapp -p 3000:3000 myapp:${BUILD_NUMBER}
                '''
            }
        }
    }
}

Example 2: Multi-Branch Pipeline

Create Jenkinsfile in your repository:

pipeline {
    agent any
    
    stages {
        stage('Build') {
            steps {
                echo "Building branch: ${env.BRANCH_NAME}"
                sh 'make build'
            }
        }
        
        stage('Test') {
            steps {
                sh 'make test'
            }
        }
        
        stage('Deploy') {
            when {
                branch 'main'
            }
            steps {
                echo 'Deploying to production...'
                sh 'make deploy'
            }
        }
    }
}

Then create Multi-branch Pipeline in Jenkins to auto-discover branches!

Example 3: Parallel Execution

pipeline {
    agent any
    
    stages {
        stage('Parallel Tests') {
            parallel {
                stage('Unit Tests') {
                    steps {
                        sh 'npm run test:unit'
                    }
                }
                stage('Integration Tests') {
                    steps {
                        sh 'npm run test:integration'
                    }
                }
                stage('E2E Tests') {
                    steps {
                        sh 'npm run test:e2e'
                    }
                }
            }
        }
    }
}

๐Ÿšจ Fix Common Problems

Problem 1: Jenkins Wonโ€™t Start

Symptom: Service fails to start ๐Ÿ˜ฐ

Fix:

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

# Common issue: Java not found
which java
# If not found, reinstall Java

# Check port conflict
sudo netstat -tlnp | grep 8080
# If occupied, change port in:
sudo vi /etc/sysconfig/jenkins
# JENKINS_PORT="8081"

# Restart Jenkins
sudo systemctl restart jenkins

Problem 2: Build Failures

Symptom: Jobs fail immediately ๐Ÿ”ด

Fix:

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

# Install build tools
sudo dnf install -y nodejs npm maven gradle

# Add Jenkins to docker group (if using Docker)
sudo usermod -aG docker jenkins
sudo systemctl restart jenkins

# Check environment variables
# In job configuration, add:
# Environment variables:
# PATH+EXTRA=/usr/local/bin:/opt/tools/bin

Problem 3: Plugin Issues

Symptom: Plugins wonโ€™t install or update ๐Ÿ”Œ

Fix:

# Update Jenkins
sudo dnf update jenkins

# Clear plugin cache
sudo rm -rf /var/lib/jenkins/plugins/*.tmp
sudo rm -rf /var/lib/jenkins/plugins/*.bak

# Restart Jenkins
sudo systemctl restart jenkins

# Manual plugin install
# Download .hpi file from https://plugins.jenkins.io/
# Upload via Manage Jenkins โ†’ Manage Plugins โ†’ Advanced

๐Ÿ“‹ Simple Commands Summary

TaskLocation/CommandPurpose
Start Jenkinssudo systemctl start jenkinsStart service
Stop Jenkinssudo systemctl stop jenkinsStop service
View logssudo journalctl -u jenkins -fMonitor logs
Initial passwordsudo cat /var/lib/jenkins/secrets/initialAdminPasswordFirst login
Backuptar -czf jenkins-backup.tar.gz /var/lib/jenkins/Backup data
Plugin listManage Jenkins โ†’ Plugin ManagerView plugins
Create jobNew Item โ†’ Select typeNew automation
View buildsBuild HistoryExecution logs
System infoManage Jenkins โ†’ System InformationDebug info

๐Ÿ’ก Tips for Success

๐Ÿš€ Performance Optimization

Make Jenkins super fast:

# Increase heap memory
sudo vi /etc/sysconfig/jenkins
# JENKINS_JAVA_OPTIONS="-Xmx2g -Xms1g"

# Enable build executors
# Manage Jenkins โ†’ Configure System
# # of executors: 4

# Use pipeline caching
# In Jenkinsfile:
options {
    skipDefaultCheckout()
    timestamps()
    buildDiscarder(logRotator(numToKeepStr: '10'))
}

๐Ÿ”’ Security Best Practices

Keep Jenkins secure:

  1. Enable security - Use matrix-based security! ๐Ÿ”
  2. HTTPS only - Configure SSL certificates! ๐Ÿ”‘
  3. Strong passwords - Enforce password policy! ๐Ÿ›ก๏ธ
  4. Limit access - Use role-based permissions! ๐Ÿ‘ฅ
  5. Regular updates - Keep Jenkins updated! ๐Ÿ“ฆ
# Setup HTTPS with reverse proxy
sudo dnf install -y nginx

# Configure nginx
cat << 'EOF' > /etc/nginx/conf.d/jenkins.conf
server {
    listen 443 ssl;
    server_name jenkins.example.com;
    
    ssl_certificate /etc/ssl/certs/jenkins.crt;
    ssl_certificate_key /etc/ssl/private/jenkins.key;
    
    location / {
        proxy_pass http://localhost:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}
EOF

sudo systemctl restart nginx

๐Ÿ“Š Monitoring and Backup

Keep Jenkins healthy:

# Automated backup script
cat << 'EOF' > /usr/local/bin/backup-jenkins.sh
#!/bin/bash
BACKUP_DIR="/backup/jenkins"
DATE=$(date +%Y%m%d)

# Create backup directory
mkdir -p $BACKUP_DIR

# Stop Jenkins
sudo systemctl stop jenkins

# Backup Jenkins home
tar -czf $BACKUP_DIR/jenkins-$DATE.tar.gz /var/lib/jenkins/

# Start Jenkins
sudo systemctl start jenkins

# Keep only last 7 backups
find $BACKUP_DIR -name "*.tar.gz" -mtime +7 -delete

echo "Backup completed: jenkins-$DATE.tar.gz"
EOF

chmod +x /usr/local/bin/backup-jenkins.sh
# Add to cron: 0 2 * * * /usr/local/bin/backup-jenkins.sh

๐Ÿ† What You Learned

Youโ€™re now a Jenkins CI/CD expert! ๐ŸŽ“ Youโ€™ve successfully:

  • โœ… Installed Jenkins on AlmaLinux 9
  • โœ… Configured initial setup
  • โœ… Created freestyle projects
  • โœ… Built pipelines as code
  • โœ… Set up continuous integration
  • โœ… Implemented deployment workflows
  • โœ… Mastered automation pipelines

Your CI/CD platform is production-ready! ๐Ÿš€

๐ŸŽฏ Why This Matters

Jenkins transforms software delivery! With your CI/CD server, you can:

  • ๐Ÿš€ Deploy faster - Automate everything!
  • ๐Ÿ›ก๏ธ Reduce errors - Consistent processes!
  • ๐Ÿ“Š Track everything - Full visibility!
  • ๐Ÿ‘ฅ Collaborate better - Shared pipelines!
  • ๐Ÿ’ฐ Save time - Let Jenkins do the work!

Youโ€™re not just building software - youโ€™re automating the entire delivery pipeline! Every commit is tested, every deployment is tracked! ๐ŸŽญ

Keep automating, keep delivering, and remember - with Jenkins, continuous delivery is just a pipeline away! โญ

May your builds be green and your deployments smooth! ๐Ÿš€๐ŸŽฏ๐Ÿ™Œ