How to Install and Configure the Jenkins on Ubuntu 22.04

Install and configure the jenkins on ubuntu 22.04; In this tutorial, i am going to show you how to install and configure jenkins on ubuntu 22.04.

How to Install and configure the Jenkins on Ubuntu 22.04

Just use the below given steps to install and configure jenkins on ubuntu 22.04:

  • Step 1 – Add Jenkins GPG key
  • Step 2 – Add Jenkins Stable Debian Package
  • Step 3 – Update Dependencies
  • Step 4 – Install Jenkins on Ubuntu
  • Step 5 – Opening the Firewall
  • Step 6 – Setting Up Jenkins

Step 1 – Add Jenkins GPG key

Open your command prompt and execute the following command on the command prompt to add Jenkins GPG key:

wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -

Step 2 – Add Jenkins Stable Debian Package

Run the following command on the command prompt to add Jenkins stable Debian package repository:

echo "deb https://pkg.jenkins.io/debian-stable binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list

Step 3 – Update Dependencies

Run apt update so that apt will use the new repository:

sudo apt update

Step 4 – Install Jenkins on Ubuntu

Run the following command on command prompt to install Jenkins and its dependencies:

sudo apt install jenkins

Then run the following command on command prompt to confirm its status:

systemctl status jenkins

If its not running, start Jenkins using the running the following command on command prompt:

sudo systemctl start jenkins

Step 5 – Opening the Firewall

By default, Jenkins runs on port 8080. Open that port using ufw:

sudo ufw allow 8080

Note: If the firewall is inactive, the following commands will allow OpenSSH and enable the firewall:

sudo ufw allow OpenSSH
sudo ufw enable

Check ufw’s status to confirm the new rules:

sudo ufw status

You’ll notice that traffic is allowed to port 8080 from anywhere:

OutputStatus: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
8080                       ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)
8080 (v6)                  ALLOW       Anywhere (v6)

With Jenkins installed and a firewall configured, you have completed the installation stage and can continue with configuring Jenkins.

Step 6 – Setting Up Jenkins

Use default port, 8080 with your server domain name or IP to set up your installation; address: http://your_server_ip_or_domain:8080

Now, we should receive the Unlock Jenkins screen, which displays the location of the initial password:

In the terminal window, use the cat command to display the password:

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

Conclusion

Install and configure the jenkins on ubuntu 22.04; In this tutorial, i have shown to you how to install and configure jenkins on ubuntu 22.04.

Leave a Comment