Important: Jenkins requires a compatible version of Java. Ensure you have Java 17 installed on your system before proceeding with the steps below.

1. Update Your System

Open your terminal and ensure your package list is updated and upgrades are applied:

sudo apt update
sudo apt upgrade -y

2. Add the Jenkins Repository Key

Download and add the GPG key for the Jenkins repository:

sudo wget -O /etc/apt/keyrings/jenkins-keyring.asc \\
  <https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key>

3. Add the Jenkins Repository to Your Sources List

Add the Jenkins stable repository to your system's software sources:

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

4. Update Your Package List and Install Jenkins

Update your package list again to include the Jenkins repository, then install Jenkins:

sudo apt update
sudo apt install jenkins -y