Yashwanth Perli
Atomic Learning


Atomic Learning

Install Jenkins on Ubuntu 22.04 LTS

Install Jenkins on Ubuntu 22.04 LTS

Yashwanth Perli's photo
Yashwanth Perli
·Jan 16, 2023·

2 min read

Jenkins is a popular open-source tool for continuous integration and continuous delivery that can help automate the building, testing, and deployment of software. In this article, I will show you how to install Jenkins on an Ubuntu 22 machine.

Before we begin, make sure that your Ubuntu machine is up-to-date by running the following commands:

apt update
sudo apt upgrade

Next, we will need to install the Java Development Kit (JDK) on our machine. Jenkins requires Java to run, so we need to install it before we can install Jenkins. To install the JDK, run the following command:

apt install openjdk-11-jdk

Once the JDK is installed, we can proceed to install Jenkins. Jenkins provides a package for Ubuntu that we can use to install it. First, we need to add the Jenkins package repository to our machine. To do this, run the following commands:

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

sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

Then, we can install Jenkins by running the following command:

sudo apt update
sudo apt install jenkins

Once Jenkins is installed, it will automatically start running as a service on your machine. You can check the status of the Jenkins service by running the following command:

systemctl status jenkins

If the service is running, you should see output similar to the following:

Copy code● jenkins.service - LSB: Start Jenkins at boot time
   Loaded: loaded (/etc/init.d/jenkins; generated)
   Active: active (running) since Mon 2023-01-16 15:12:56 IST; 1h 34min ago
     Docs: man:systemd-sysv-generator(8)

Now that Jenkins is installed and running, you can access the Jenkins web interface by visiting your-server-ip:8080 in your web browser. The initial setup requires you to unlock Jenkins using the initial admin password, which can be found in the following file:

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

Once you have unlocked Jenkins, you can start creating jobs and configuring your Jenkins server.

In summary, installing Jenkins on Ubuntu 22.04 LTS involves installing the JDK, adding the Jenkins package repository, and then installing the Jenkins package. Once Jenkins is installed, it will automatically start running as a service, and you can access the web interface to start configuring your Jenkins server.

Share this