Guides / CI (Continuous Integration)

How to Install & Set Up Jenkins

Install the Jenkins LTS automation server on Ubuntu (or via Docker), unlock it, write a real declarative Pipeline, and attach a build agent.

Updated 20268-step setupDownload Jenkins →

Prerequisites

  • ✓A host with 2 GB+ RAM for the controller (agents doing the actual building want more, depending on what they build)
  • ✓Java 17 or 21 (installed below on Ubuntu)

Controller, agents, and jobs — how Jenkins is put together

The Jenkins process you install below is the controller: it serves the web UI, stores configuration and build history, and schedules work — but by default it also runs builds on itself via a 'built-in node', which is fine for a lab and something you'll want to change once real traffic shows up (see the agent section below).

Almost everything past the core is a plugin — SCM integrations, notification channels, cloud agent provisioners, and the Pipeline engine itself all arrive as plugins, which is why the initial setup wizard spends most of its time installing them.

A job is a unit of work. Freestyle jobs configure a build through UI form fields and were the original Jenkins model; Pipeline jobs read a Jenkinsfile — a script, checked into your repo alongside the code it builds — which is the standard approach today because the build definition is versioned, reviewable, and portable between Jenkins instances.

Install Jenkins on Ubuntu (LTS repo)

terminal
sudo apt update
sudo apt install -y fontconfig openjdk-17-jre
sudo wget -O /etc/apt/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
echo "deb [signed-by=/etc/apt/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install -y jenkins
sudo systemctl enable --now jenkins

Install Jenkins on RHEL, CentOS Stream, or Fedora (LTS repo)

terminal
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
sudo dnf install -y fontconfig java-17-openjdk jenkins
sudo systemctl enable --now jenkins

Alternative — run Jenkins in Docker

terminal
docker run -d --name jenkins \
  -p 8080:8080 -p 50000:50000 \
  -v jenkins_home:/var/jenkins_home \
  jenkins/jenkins:lts
!

Port 50000 is only needed if you plan to attach JNLP-based build agents (see below) — safe to drop the mapping if the controller will always run its own builds.

Unlock and verify

Browse to http://your-server:8080 and paste the initial admin password to get past the setup wizard's unlock screen. Take the wizard's 'Install suggested plugins' option unless you have a specific reason not to — it covers Git, Pipeline, and credentials support, which you'll want immediately.

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

Write your first Pipeline

Create a Jenkinsfile at the root of a repository, then point a new Pipeline job at that repo — Jenkins reads the file straight from source control on every run.

Jenkinsfile
pipeline {
    agent any

    stages {
        stage('Build') {
            steps {
                sh 'npm ci'
                sh 'npm run build'
            }
        }
        stage('Test') {
            steps {
                sh 'npm test'
            }
        }
        stage('Deploy') {
            when { branch 'main' }
            steps {
                sh './deploy.sh'
            }
        }
    }

    post {
        failure {
            echo 'Build failed — check the console log.'
        }
    }
}
!

In the Jenkins UI: New Item → Pipeline → under Pipeline, set 'Pipeline script from SCM', point it at your repo, and set the script path to Jenkinsfile.

Attach a build agent

Once builds need isolation, more capacity, or a specific toolchain the controller doesn't have, add a separate agent node rather than building on the controller. Manage Jenkins → Nodes → New Node walks you through it and, for an inbound (JNLP) agent, hands you a ready-to-run command like the one below to execute on the agent machine.

terminal
java -jar agent.jar -url http://your-server:8080/ \
  -secret AGENT_SECRET -name my-agent -workDir "/home/jenkins/agent"

Keep secrets out of the Jenkinsfile

Never hardcode credentials in a pipeline script that's checked into a repo. Add them once under Manage Jenkins → Credentials, then reference the credential ID from the Jenkinsfile — Jenkins injects the real value at run time and masks it in the console log.

terminal
withCredentials([usernamePassword(credentialsId: 'docker-hub', usernameVariable: 'USER', passwordVariable: 'PASS')]) {
    sh 'docker login -u "$USER" -p "$PASS"'
}

Documentation & Knowledge Base

Official DocumentationJenkins Documentation →Knowledge Base & CommunityJenkins Community →
Download Jenkins— all versions & official links→

Related Guides

Woodpecker CIInstall guide →Concourse CIInstall guide →Argo CDInstall guide →

Need Jenkins deployed and managed for you?

We're OpenStack Dev — we design, deploy, and operate production DevOps infrastructure.

Get in TouchAll Install Guides