Day 50 of 90 Days of DevOps Challenge: Jenkins Installation & Master-Agent Setup

Vaishnavi DVaishnavi D
2 min read

Yesterday, I dived deep into Jenkins architecture, learning how it scales using the master-agent (controller-worker) model and explored Freestyle jobs, Declarative pipelines, and Scripted pipelines. I understood the importance of pipeline-as-code and why Jenkins is a core CI/CD tool in any DevOps stack.

Today was all about practical implementation: I installed Jenkins on an Ubuntu EC2 instance and set up a remote Jenkins agent (slave node) using SSH.

Jenkins Installation

Jenkins is not available by default in the yum repositories, so we first added the official Jenkins repo and installed the necessary dependencies.

Step-by-Step:

# Switch to root
sudo -i

# Update system
sudo yum update -y

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

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

# Upgrade system packages
sudo yum upgrade

# Install Java 17 (Amazon Corretto)
sudo yum install java-17-amazon-corretto -y

# Install Jenkins
sudo yum install jenkins -y

# Enable and start Jenkins service
sudo systemctl enable jenkins
sudo systemctl start jenkins
sudo systemctl status jenkins

Get Initial Admin Password:

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

Jenkins is now live on:

http://<your-public-ip>:8080

Master-Agent Architecture Setup

After Jenkins installation, I set up a remote build agent (slave node) to delegate job execution from the master.

Steps:

  1. Install SSH Agent Plugin

    • Go to: Manage Jenkins → Plugin Manager → SSH Build Agents Plugin
  2. Create a new EC2 instance

    Change its hostname:

     sudo hostnamectl set-hostname <node-name>
    
  3. Install Java on the agent

     sudo apt update
     sudo apt install openjdk-17-jdk -y
    

    Configure new node in Jenkins

    • Go to: Manage Jenkins → Nodes → New Node

    • Type: Permanent Agent

    • Set:

      • Name: node-1

      • Number of executors: 1 (or match your CPU count)

      • Remote root directory: /home/ubuntu

      • Launch method: Launch agents via SSH

      • Host: Private IP of agent EC2

      • Credentials: Use SSH key from your .pem file:

          cat <your-key>.pem
          # Copy & paste the contents when adding credentials in Jenkins
        
  4. Save and launch the agent

    • Once configured, Jenkins will connect via SSH and install the agent jar

    • You’ll now see the agent listed as online in the dashboard

Final Thoughts

Today’s setup helped bridge theory with practice. From installing Jenkins manually on an Ubuntu EC2 instance to securely connecting remote agents via SSH, this exercise gave me real insight into how enterprise-level Jenkins deployments are structured.

I now have a scalable Jenkins setup ready for automation. Next, I’ll be writing my first Jenkins pipeline (Declarative) and triggering it via GitHub Webhooks to automatically build and deploy a sample app.

Let’s automate!

0
Subscribe to my newsletter

Read articles from Vaishnavi D directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Vaishnavi D
Vaishnavi D