"How to install Jenkins in Ubuntu: A Beginner's Tutorial"

Introduction Jenkins is a open-source automation server widely used for continuous integration and delivery (CI/CD). Originally developed by Kohsuke Kawaguchi in 2011, Jenkins has become one of the most popular tools for automating the process of building, testing, and deploying software. Its flexibility, large plugin ecosystem, and active community make it a go-to solution for developers and teams looking to streamline their workflows and reduce manual errors. In this tutorial you will install Jenkins on Ubuntu 22.04, start the development server and create an administrative user to get started exploring Jenkins automation. Prerequisites Before starting, make sure you have: • An AWS EC2 instance (Ubuntu 22.04, t2.medium) • Ports 8080 (Jenkins) open in Security Group → Inbound Rules Installed: ○ Docker: sudo apt install docker.io -y ○ Docker Desktop (optional GUI) ○ Java (e.g., OpenJDK 11 or 17) ○ Jenkins ○ Node.js v22: Install Guide for Node.js 22 ○ npm: sudo apt install npm Step-by-Step Guide Step 1: Update Your System Run the following commands to make sure your system is up to date: bash: sudo apt update sudo apt upgrade -y Step 2 : Installing Java Jenkins requires Java. Install OpenJDK 11: bash: sudo apt update sudo apt install fontconfig openjdk-21-jre java -version openjdk version "21.0.3" 2024-04-16 OpenJDK Runtime Environment (build 21.0.3+11-Debian-2) OpenJDK 64-Bit Server VM(build 21.0.3+11-Debian-2, mixed mode, sharing) Verify the installation: java --version Step 3: Installing Jenkins Since the Jenkins version in Ubuntu’s default repositories is frequently older, it's best to install it from the project’s official repository to get the most recent updates and improvements. bash: 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 sudo apt-get update sudo apt-get install jenkins Verify the installation: jenkins --version Step 4: Start and Enable Jenkins Enable Jenkins to start on boot and launch the service. bash: sudo systemctl start jenkins sudo systemctl enable jenkins Check the status: sudo systemctl status jenkins Step 5: Access Jenkins Web Interface Open your browser and go to: your instance public IP:8080 Example: 12:123:62:8080 Steps to Enable Password-less sudo Access for Jenkins: Open the sudoers file safely: bash: sudo visudo Add this line at the end of the file: jenkins ALL=(ALL) NOPASSWD: ALL This grants the jenkins user password-less access to all commands via sudo. Step 6: Unlock Jenkins You’ll see a screen asking for the initial admin password. Find it with. bash: sudo cat /var/lib/jenkins/secrets/initialAdminPassword Copy the 32-character alphanumeric password from the terminal and paste it into the Administrator password field, then click Continue. On the next screen, you can option to install the suggested plugins or manually select the ones you need. We'll proceed by selecting Install suggested plugins, which triggers the installation immediately. When the installation is complete, you will be suggest to set up the first administrative user. you can skip this step and continue as admin using the initial password from above ,but we will create the user. Enter the name and password according to your choice. Then click save and continue. Next, you’ll see the Instance Configuration page, where you’ll need to confirm the URL for your Jenkins instance—either a domain name or the server’s IP address. Click Save and Finish. Then you will receive a confirmation page that "Jenkins is Ready!". Click Start using Jenkins to visit the Dashboard of Jenkins. Step 7: Install Suggested Plugins Once you logged in, Jenkins will ask you to install the suggested plugins for optimal functionality, or you can choose to install only the plugins you need. Conclusion In this tutorial, you successfully installed Jenkins using the official packages provided by the project. You started the Jenkins server, configured your system’s firewall to allow web access, and created an administrative user to manage your Jenkins environment. With these essential steps completed, your Jenkins instance is now up and running. You’re ready to start exploring Jenkins’ powerful automation features—such as setting up your first project, integrating with version control systems like Git, and configuring build pipelines to streamline your development workflows. Thanks for learning with My Community.

May 6, 2025 - 20:01
 0
"How to install Jenkins in Ubuntu: A Beginner's Tutorial"

Introduction

Jenkins is a open-source automation server widely used for continuous integration and delivery (CI/CD).
Originally developed by Kohsuke Kawaguchi in 2011, Jenkins has become one of the most popular tools for automating the process of building, testing, and deploying software. Its flexibility, large plugin ecosystem, and active community make it a go-to solution for developers and teams looking to streamline their workflows and reduce manual errors.

In this tutorial you will install Jenkins on Ubuntu 22.04, start the development server and create an administrative user to get started exploring Jenkins automation.

Prerequisites

Before starting, make sure you have:
• An AWS EC2 instance (Ubuntu 22.04, t2.medium)
• Ports 8080 (Jenkins) open in Security Group → Inbound Rules
Installed:
○ Docker: sudo apt install docker.io -y
○ Docker Desktop (optional GUI)
○ Java (e.g., OpenJDK 11 or 17)
○ Jenkins
○ Node.js v22: Install Guide for Node.js 22
○ npm: sudo apt install npm

Step-by-Step Guide

Step 1: Update Your System

Run the following commands to make sure your system is up to date:
bash:
sudo apt update
sudo apt upgrade -y

Step 2 : Installing Java

Jenkins requires Java. Install OpenJDK 11:
bash:
sudo apt update
sudo apt install fontconfig openjdk-21-jre
java -version
openjdk version "21.0.3" 2024-04-16
OpenJDK Runtime Environment (build 21.0.3+11-Debian-2)
OpenJDK 64-Bit Server VM(build 21.0.3+11-Debian-2, mixed mode, sharing)
Verify the installation:
java --version

Step 3: Installing Jenkins

Since the Jenkins version in Ubuntu’s default repositories is frequently older, it's best to install it from the project’s official repository to get the most recent updates and improvements.
bash:
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
sudo apt-get update
sudo apt-get install jenkins

Verify the installation:
jenkins --version

Step 4: Start and Enable Jenkins

Enable Jenkins to start on boot and launch the service.
bash:
sudo systemctl start jenkins
sudo systemctl enable jenkins
Check the status:
sudo systemctl status jenkins

Step 5: Access Jenkins Web Interface

Open your browser and go to:
your instance public IP:8080
Example:
12:123:62:8080

Steps to Enable Password-less sudo Access for Jenkins:

  1. Open the sudoers file safely: bash: sudo visudo
  2. Add this line at the end of the file: jenkins ALL=(ALL) NOPASSWD: ALL This grants the jenkins user password-less access to all commands via sudo.

Step 6: Unlock Jenkins

You’ll see a screen asking for the initial admin password. Find it with.

Image description
bash:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the 32-character alphanumeric password from the terminal and paste it into the Administrator password field, then click Continue.

On the next screen, you can option to install the suggested plugins or manually select the ones you need.

Image description
We'll proceed by selecting Install suggested plugins, which triggers the installation immediately.

Image description
When the installation is complete, you will be suggest to set up the first administrative user. you can skip this step and continue as admin using the initial password from above ,but we will create the user.

Image description
Enter the name and password according to your choice. Then click save and continue.

Next, you’ll see the Instance Configuration page, where you’ll need to confirm the URL for your Jenkins instance—either a domain name or the server’s IP address.
Image description
Click Save and Finish.

Then you will receive a confirmation page that "Jenkins is Ready!".

Image description
Click Start using Jenkins to visit the Dashboard of Jenkins.

Image description

Step 7: Install Suggested Plugins

Once you logged in, Jenkins will ask you to install the suggested plugins for optimal functionality, or you can choose to install only the plugins you need.

Conclusion

In this tutorial, you successfully installed Jenkins using the official packages provided by the project. You started the Jenkins server, configured your system’s firewall to allow web access, and created an administrative user to manage your Jenkins environment. With these essential steps completed, your Jenkins instance is now up and running.

You’re ready to start exploring Jenkins’ powerful automation features—such as setting up your first project, integrating with version control systems like Git, and configuring build pipelines to streamline your development workflows.

Thanks for learning with My Community.