How to Install Jenkins on Ubuntu 24.04 Step-by-Step

In this blog post, we will explain how to install Jenkins on Ubuntu 24.04 step-by-step.Jenkins is an open-source automation server widely used for continuous integration and continuous deployment (CI/CD) in software development. Jenkins offers user friendly Interface which allows to create Jobs and pipelines to simplify the process of building, testing, and deploying code.PrerequisitesPre-Install Ubuntu 22.04Non-root user with sudo privilegesAt least 2GB RAM or more40 GB disk spaceInternet ConnectivityWithout much fuss , let’s deep dive into Jenkins installation steps on Ubuntu 24.04.1) Install JavaJenkins is a Java based application, so we recommend to install OpenJDK 17 for latest and stable Jenkins. Open the terminal and run following commands.$ sudo apt update
$ sudo apt install fontconfig openjdk-17-jre -yOnce the java is installed on your system, run beneath command to its version$ java –versionPerfect! We now have OpenJDK installed. We can now proceed.2) Add Jenkins APT RepositoryThe default apt repositories of Ubuntu 24.04 does not have Jenkins package, so for its installation add APT repository using following set of commands.$ sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key

$ 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/null3) Install Jenkins on Ubuntu 24.04As all prerequisites are met, so we are good to proceed with Jenkins installation. Execute following apt commands.$ sudo apt update
$ sudo apt install jenkins -yOnce the installation is complete, Jenkins should start automatically. To confirm this, run the command:$ systemctl status jenkinsIf by any chance Jenkins is not running, execute the following command to start it.$ sudo systemctl start jenkins3) Configure Firewall Rules for JenkinsAs we have seen, Jenkins natively listens on port 8080, and if you have installed Jenkins on a server with UFW enabled, you need to open that port to allow traffic.To enable firewall on Ubuntu 24.04, run$ sudo ufw enableTo allow port 8080 in ufw firewall, run the command:$ sudo ufw allow 8080/tcpThen reload the firewall to effect the changes.$ sudo ufw reloadTo confirm that port 8080 is open on the firewall, execute the command:$ sudo ufw statusFrom the output, we can clearly see that Port 8080 has been opened on the system.4) Finish Jenkins Initial SetupWe are almost done now. The only thing remaining is to finish Jenkins initial setup using web interface. So, head over to the URL bar and browse your server’s address as shown:http://<Ubuntu-System-IP>:8080To check your server’s IP address, use the ip command.You will get the page similar to what we have below prompting you to provide the Administrator’s password. As per the instructions, the password is located in the file:/var/lib/jenkins/secrets/initialAdminPasswordTo view the password, use the cat command as shown:$ sudo cat /var/lib/jenkins/secrets/initialAdminPasswordCopy the password and paste it in the text field shown and click the “Continue” button.In the next step, select ‘Install suggested plugin‘ for simplicity’s sake.Thereafter, the installation of the necessary plugin required by Jenkins will commence.When the installation of plugins is complete, the installer will take you to the next section where you will be required to create an Admin user and click on the ‘Save and Continue’ button.The next step will populate the default URL for your Jenkin’s instance. No action is required, simply click ‘Save and Finish’.Finally, click on the ‘Start using Jenkins’ button to gain access to Jenkins dashboard.This ushers you to Jenkin’s dashboard as shown.5) Test Jenkins InstallationIn order to test Jenkins installation, let’s create a demo job as shown below,That’s all from this post, we believe you have found it informative and useful. Feel free to post your queries and feedback in below comment section.Also Read : How to Install Jenkins on RHEL 9/8 (Simple Guide)

Latest articles

Related articles