How to Install Jenkins on Ubuntu 22.04

In this blog post, we will show you how to install Jenkins on Ubuntu 22.04 for seamless DevOps Integration.

In the fast-paced world of DevOps, Jenkins stands out as a powerful and popular automation server that facilitates continuous integration and continuous delivery (CI/CD). If you’re using Ubuntu 22.04 and eager to streamline your development pipeline, then you’re in the right place.

[ez-toc]

Prerequisites

  • A running Ubuntu 22.04 system,
  • A user account with sudo privileges.
  • Internet Connectivity

Without any delay, let’s deep dive into Jenkins installation steps.

1) Install Java

Jenkins is a Java-based application, so you need to install Java Development Kit (JDK). OpenJDK is a widely used option. Open terminal and run below commands to install OpenJDK 17.

Note: OpenJDK and its dependencies are available in the default apt repositories.

$ sudo apt update
$ sudo apt install fontconfig openjdk-17-jre -y

Install-OpenJDK-Jenkins-Ubuntu-22-04

Verify the Java version by running:

$ java -version

Check-Java-Version-Ubuntu-22-04

2) Add Jenkins Repository

Jenkins is not available in the default package repositories of Ubuntu 22.04. So we will be adding its official apt repository. Execute the following 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/null

Add-Jenkins-Apt-Repository-Ubuntu-22-04

3) Install Jenkins on Ubuntu 22.04

Now, install Jenkins using the following apt commands.

$ sudo apt update
$ sudo apt install Jenkins -y

Install-Jenkins-on-Ubuntu-22-04

4) Start and Enable Jenkins Service

Whenever we install Jenkins using apt command then its service started automatically, to verify Jenkins service status, run following command.

Jenkins-Service-Status-Ubuntu-22-04

In order to enable jenkins service across the reboot then run beneath systemctl command.

$ sudo systemctl enable Jenkins

Allow Jenkins ports in the firewall in case firewall is enable on your Ubuntu 22.04 system.

$ sudo ufw allow 8080/tcp
$ sudo ufw reload

5) Access Jenkins Setup Wizard

Jenkins runs on port 8080 by default. Open your web browser and navigate to the following URL:

http://Server-IP-Address-Or-FQDN:8080

Jenkins-Web-Interface-First-Page-Ubuntu-22-04

Retrieve the Jenkins unlock key by executing the following command.

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

Copy this password and paste it on “Administrator password” field as show below:

Jenkins-Initial-Admin-Password-Ubuntu-22-04

Click on Continue

Once unlocked, select “Install suggested plugins” to ensure a smooth Jenkins experience.

Install-Suggested-Jenkins-Plugins-Ubuntu-22-04

Installing-Suggested-Pulgins-Installation-Progress-Jenkins

Next, create your admin user and its credentials for Jenkins.

Creating-Admin-User-Jenkins-Web-Interface-Ubuntu-22-04

Click on “Save and Continue

In the next window, specify the Jenkins URL; usually, it’s the same as your initial access URL.

Jenkins-URL-Instance-Configuration-Ubuntu-22-04

Click on “Save and Finish”.

Jenkins-Ready-for-Use-Ubuntu-22-04

Click on “Start using Jenkins” and this will take us to Jenkins dashboard.

Jenkins-Dashboard-Post-Installation-Ubuntu-22-04

Great, above dashboard confirms that you have successfully installed Jenkins on Ubuntu 22.04.

6) Test Jenkins Installation

In order to test our Jenkins installation, let’s create demo job. Follow the instructions as shown in below image.

Jenkins-Demo-Job-Ubuntu-22-04

That’s all from this post, we hope you have found it useful and informative. Start exploring Jenkins user-friendly interface and configure it according to your project requirements. Kindly do post your feedback and queries in below comments section.

Also Read: How to Install Jenkins on RHEL 9 | Rocky Linux 9 | AlmaLinux 9

Leave a Comment

5 + six =