Jenkins is one of the most popular open-source automation servers used for continuous integration and continuous delivery (CI/CD). Installing Jenkins on Ubuntu 24.04 is relatively straightforward, but you may encounter some common issues along the way. This guide walks you through the installation process and troubleshooting steps for issues like port conflicts and service failures.
Prerequisites
Before starting, ensure the following:
Ubuntu 24.04 installed on your system.
Sudo privileges on the user account.
Java 11 or 17 installed, as Jenkins requires Java to run.
Step 1: Update System Packages
Begin by updating your package index to ensure you’re working with the latest versions of system packages:
sudo apt update && sudo apt upgrade -y
Step 2: Install Java
Jenkins requires Java, so install it if it's not already available:
sudo apt install openjdk-17-jdk -y
Verify the installation:
java -version
You should see output similar to:
openjdk version "17.x.x"
Step 3: Add the Jenkins Repository
Add Jenkins to your system’s software repository list by importing the Jenkins key and repository:
- Import the GPG key:
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
- Add the Jenkins repository:
echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]" \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
Step 4: Install Jenkins
After adding the repository, install Jenkins using the following commands:
sudo apt update
sudo apt install jenkins -y
Step 5: Start and Enable Jenkins
Start the Jenkins service:
sudo systemctl start jenkins
Enable Jenkins to start automatically at boot:
sudo systemctl enable jenkins
Step 6: Access Jenkins
Jenkins, by default, runs on port
8080
. Open your web browser and navigate to:http://<your-server-ip>:8080
Retrieve the initial admin password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy this password, paste it into the setup wizard, and follow the prompts to complete the initial configuration.