Jenkins is software widely used for automating tasks such as building, testing, and deploying applications. It can efficiently manage your software projects. With a variety of plugins, you can customize Jenkins based on your project’s needs and requirements.
Additionally, you can integrate Jenkins with Git version control to track your project versioning. This feature allows you to pull code from a Git repository to your Jenkins project.
The main purpose of this post is to present the complete process of installing Jenkins on an Ubuntu 24.04 system.
How to Install Jenkins on Ubuntu 24.04?
Step 1: Update and Upgrade Ubuntu’s Packages
To ensure that your Ubuntu 24.04 system runs smoothly, keep your system up to date by running:
sudo apt update && sudo apt upgrade -y

This command ensures that your system packages are up to date.
How to Install the Required Software for Jenkins on Ubuntu 24.04?
These below steps are needed to install the required software packages to run the Jenkins instance smoothly on your Ubuntu 24.04.
Step 1: Check Available OpenJDK Packages
If you want to know the available OpenJDK packages, this command will print a list of available OpenJDK packages on your screen:
apt list -a openjdk-*-jdk

This command displays the available compatible versions of OpenJDK, that can be installed from the APT repository.
Note: Before selecting the right version of OpenJDK, consider the official documentation of Jenkins.
Step 2: Install OpenJDK 21 for Jenkins
To ensure compatibility with Jenkins on your Ubuntu 24.04, install OpenJDK 21 by running the command:
sudo apt install openjdk-21-jdk fontconfig -y


In addition, the “fontconfig” package is included to ensure that Jenkins can correctly display fonts.
Step 3: Verify OpenJDK Installation
The installation of OpenJDK-21 can be verified through the below mentioned command:
java -version

If the command displays the installed version of OpenJDK, such as 21.0.3, it verifies that OpenJDK is correctly set up on your system.
How to Install Jenkins Package on Ubuntu 24.04?
The following steps-wise guide will set up and integrate the Jenkins package on your Ubuntu 24.04.
Step 1: Download Jenkins’ Keyring via “wget”
To install the newest, stable, and secure version of the Jenkins package, download the keyring using the “wget” command. Copy and execute the following command:
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key

If the command returns an empty output, it shows that the Jenkins keyring has been downloaded to your local system.
Step 2: Add Jenkins to Source List
Upon downloading the Jenkins keyrings, now operate the below code to add the Jenkins repository to your Ubuntu’s source list:
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

This command allows you to easily install and upgrade the Jenkins package from its official source.
Step 3: Refresh Ubuntu’s Cache
To integrate the Jenkins repository, run the command to refresh your Ubuntu 24.04 cache:
sudo apt update

You can find in the above output that the Jenken respiratory has been integrated into your system list.
Step 4: Install Jenkins Package via APT
Once your Ubuntu machine is ready, you can now install the Jenkins package through the APT package manager:
sudo apt install jenkins -y


The output printed above shows that the command executed and installed the updated version of Jenkins on your system.
How to Start Jenkins on Ubuntu 24.04?
You can easily operate the Jenkins instance on your Ubuntu 24.04 with these steps.
Step 1: Enable and Start Jenkins Service
To avoid manually enabling Jenkins each time and ensure that Jenkins starts automatically at boot operate this command:
sudo systemctl enable jenkins && sudo systemctl start jenkins

With this command, you don’t need to manually enable and start the Jenkins service every time before use.
Step 2: Confirm Jenkins Service Status
After starting the Jenkins services, verify if it is active on your Ubuntu 24.04 system:
sudo systemctl status jenkins

As presented above, the Jenkins service is perfectly running on your Ubuntu 24.40 machine.
Step 3: Print Jenkins Admin Password
To set up and access Jenkins for the first time on your system, you will need the Jenkins admin password. This command will display the initial admin password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword

This process is essential to unlock the web interface and proceed with further configuration of Jenkins on your Ubuntu 24.04 system.
Step 4: Check Jenkins’ Default Port
To check the default port used by Jenkins to access the web interface on local machine, use the command:
cat /etc/default/jenkins | grep HTTP_PORT

As shown, the Jenkins web interface can be accessed on port 8080.
How to Configure Jenkins on Ubuntu 24.04 Localhost?
The below are the necessary steps to configure the Jenkins Instance on your Ubuntu 24.04 localhost.
Step 1: Access Jenkins Instance
Open this URL on your web browser to access the Jenkins web interface on your localhost:
http://localhost:8080/

Enter the initial admin password to start further configuration of Jenkins on your system.
Step 2: Install Jenkins Plugins
Choose one of the following two options based on your requirements to install Jenkins plugins on your system:

While you can customize the Jenkins plugin installation, it is recommended to install the suggested plugins.
Step 3: Create Jenkins Admin User
Next, specify the user information to create the first Jenkins admin user:

Remember your credentials to use them for accessing Jenkins Instance.
Step 4: Save and Finish the Jenkins Configuration
At the end, click “Save and Finish” to complete the Jenkins configuration process:

Finally, your Jenkins instance is ready to use. Click “Start using Jenkins” to access the Jenkins Dashboard:

After successfully accessing the Jenkins instance, you will see the below greeting message “Welcome to Jenkins!” on your web screen:

Enjoy using Jenkins to manage and handle your software projects.
How to Remove Jenkins Package from Ubuntu 24.04?
Perform the below commands to uninstall the Jenkins package and remove the configuration data from the Ubuntu 24.04 system.
Step 1: Stop and Disable Jenkins Service
If you want to completely remove the Jenkins services, first stop and disable the Jenkins services with this command:
sudo systemctl stop jenkins && sudo systemctl disable jenkins

Make sure that the Jenkins services have been disabled on your Ubuntu 24.04 system.
Step 2: Remove Jenkins Package
Next, utilize the “–purge” option to remove the Jenkins package along with dependencies and associated data:
sudo apt remove --purge jenkins

As mentioned in the above output, the Jenkins date has been completely removed from your Ubuntu 24.04 system.
Step 3: Verify Jenkins Removal
The Jenkins removal can be verified through the following command:
jenkins --version

If Jenkins has been successfully removed from your Ubuntu 24.04, you will be returned that Jenkins is not found.
FAQs
What packages must I install before installing the Jenkins package on Ubuntu 24.04?
Before starting the installation of Jenkins, you have to install OpenJDK and fontconfig packages via the command: “sudo apt install openjdk-21-jdk fontconfig”.
How do I easily install the Jenkins instance on my Ubuntu 24.04 system?
First, download and integrate the Jenkins repository to your source list. Then, install Jenkins using command “sudo apt install jenkins -y”.
What is the default port to access the Jenkins instance on localhost on Ubuntu 24.04?
The default port to access Jenkins on localhost is 8080. You can also check the Jenkins port from terminal: “cat /etc/default/jenkins | grep HTTP_PORT”.
Conclusion
The updated Jenkins can be set up and configured using a few commands. To smoothly run the Jenkins instance on your Ubuntu 24.04, install the OpenJDK with “sudo apt install openjdk-21-jdk fontconfig”. Then, operate the command “sudo apt install jenkins” to configure it on your Ubuntu 24.04 machine.