Build a Jenkins Server on Ubuntu 24.04: Easy Setup Tutorial

If you’re looking for a full walkthrough on installing Jenkins on Ubuntu 24.04 (along with an agent instance), you’ve come to the right place! In this video, Jay details the entire setup process of Jenkins on the latest version of Ubuntu Server during this easy to follow guide.

YouTube player

Commands Used in this Video

Installing Java

sudo apt install fontconfig openjdk-17-jre

Test Java by checking its version

java -version

Adding the key for the Jenkins repository

sudo wget -O /usr/share/keyrings/jenkins-keyring.asc

Add the Jenkins repository to your server

echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]" \ binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null

Install Jenkins

sudo apt update
sudo apt install jenkins

Log in to web console at port 8080

Unlock Jenkins

Enter the following command to retrieve your secret key from your server when you’re asked for it:

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

Adding a system user for the Jenkins Agent

sudo useradd -r -md /var/jenkins_home -s /bin/bash jenkins

Update permissions on the Jenkins home directory

chown jenkins:jenkins -R /var/jenkins_home

Note: That directory should’ve been created earlier during the test run as shown in the video.

Create a directory for the Agent’s Systemd Service

sudo mkdir -p /usr/local/jenkins-service

move the file downloaded earlier somewhere else:

sudo mv agent.jar /usr/local/jenkins-service/

Jenkins Agent Start Script

Open an editor to the file we’ll be creating:

sudo nano /usr/local/jenkins-service/

Inside the file, place the following:


cd /usr/local/jenkins-service

curl -sO

exit 0

Update the permissions for the Start Script

sudo chmod +x /usr/local/jenkins-service/

Create a Systemd Unit to start the agent

sudo nano /etc/systemd/system/jenkins-agent.service

Inside the file, place the following:

Description=Jenkins Agent

ExecStart=/bin/bash /usr/local/jenkins-service/


Refresh Systemd and enable/start the agent

sudo systemctl daemon-reload
sudo systemctl enable jenkins-agent.service
sudo systemctl start jenkins-agent.service

Brand-New Course!

Check out Jay’s new course on Ansible and start automating today!

Discount Vouchers

Receive 5% off an LPI exam voucher!

Exclusive Member Features

Support the channel and receive exclusive perks!