(Day 21) Task : How to Install Jenkins on Ubuntu (with Commands) :-

Aditya SharmaAditya Sharma
2 min read

System Requirements & Prerequisites

Before we begin, make sure:

RequirementDescription
OSUbuntu 20.04+ (or any supported LTS version)
User AccessRoot user or a user with sudo privileges
InternetRequired to download Jenkins packages
ShellTerminal/SSH access to the Ubuntu system

Step-by-Step Jenkins Installation on Ubuntu

Step 1: Update the System :

We begin by updating the system package index to ensure all existing packages are up to date.

sudo apt update
sudo apt upgrade -y

This command does two things:

  • apt update: Updates the list of available packages.

  • apt upgrade: Upgrades the existing installed packages.

Step 2: Install Java :

Jenkins runs on Java, so it must be installed first.

sudo apt install openjdk-11-jdk -y

You can verify the installation using:

java -version

Step 3: Add Jenkins Repository Key :

Jenkins packages are hosted on its official repository. First, we need to add the GPG key used to sign the packages:

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

Step 4: Add Jenkins Repository :

Now, add the official Jenkins repository to your system:

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

Then update your system again:

sudo apt update

This makes Jenkins packages available through apt.

Step 5: Install Jenkins :

Now that we’ve added the repo, we can install Jenkins:

sudo apt install jenkins -y

This installs the Jenkins service and related files.

Step 6: Check Status Of Jenkins :

Check service status:

sudo service jenkins status

Step 7: Access Jenkins in a Browser :

Now open Jenkins using your server’s IP or domain name:

<your-server-publicip>:8080

If you're using a local system:

localhost:8080

Step 8: Unlock Jenkins :

On the first access, Jenkins will ask for an initial admin password.

Get the password with this command:

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

Copy and paste the password shown in the terminal into the browser prompt.

Step 9: Install Plugins

  • After unlocking, Jenkins will ask to install plugins. Choose:

  • Install Suggested Plugins (Recommended)

  • This will install the most commonly used plugins (Git, Pipeline, Docker, etc.).

  • You can also install plugins manually later.

🎉 Congratulations! Jenkins is now ready to use.

0
Subscribe to my newsletter

Read articles from Aditya Sharma directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Aditya Sharma
Aditya Sharma

DevOps Enthusiast | Python | Chef | Docker | GitHub | Linux | Shell Scripting | CI/CD & Cloud Learner | AWS