Oct 23, 2023 5 min read

How to Install Jenkins on Debian 11

Install jenkins on debian 11 with our step-by-step tutorial. It is a popular open-source automation tool used for continuous integration.

Install Jenkins on Debian 11
Table of Contents

Choose a different version or distribution

Introduction

Before we start talking about how to install jenkins on debian 11,let's briefly understand-What is Jenkins?

Jenkins is a popular open-source automation tool used for continuous integration and continuous delivery (CI/CD) processes. It allows developers to build, test, and deploy their applications efficiently.

It supports tens of thousands of plugins that aid programmers in creating various types of software and apps.

This tutorial will guide you through the steps to install Jenkins on Debian 11.

Advantages

  1. Automation: Jenkins automates various stages of the software development lifecycle, such as building, testing, and deploying applications.
  2. Integration: Jenkins seamlessly integrates with a wide range of development tools, including version control systems, build tools, and testing frameworks.
  3. Extensibility: Jenkins offers a vast ecosystem of plugins that extend its functionality. This allows you to customize and enhance Jenkins to suit your specific requirements and workflows.
  4. Scalability: Jenkins is designed to handle small to large environments, enabling you to scale your CI/CD pipelines as your project and team grow.
  5. Community Support: Jenkins has a large and active community.

How to Install Jenkins on Debian 11

Before installing any packages, it is advised to update the Debian 11 repository. To do this, run the subsequent command:

sudo apt update

Now that all the packages have been updated, we will install the Java packages on Debian since, as we already know, the Jenkins is written in Java and therefore needs it. Run the following command to install the Java package on Debian 11:

sudo apt install default-jdk

We will import the Jenkins GPG key from its official website after installing the Java package by using the command:

curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null

The message "OK" will appear when the GPG key has been imported. when this, use the following command to import the source repository from Jenkins' official website:

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

After adding Jenkins' GPG key and source repository from its official website to the Debian 11 repository, update the Debian 11 repository once more.

 sudo apt update

Use the following command to now install the Jenkin:

sudo apt install jenkins -y

After installing Jenkins, we'll use the systemctl command to make it operational:

sudo systemctl enable jenkins

Use the systemctl command to launch Jenkins after it has been enabled:

sudo systemctl start jenkins

Execute the following commands to use the systemctl command to check Jenkins' status:

sudo systemctl status jenkins

Jenkins usually uses port 8080; to validate this, copy and paste the following URL into your browser.

http://localhost:8080
Unlock Jenkins

It will ask for a password; in order to retrieve it, return to the terminal and run the command below to access the password configuration file:

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

The password is "13a40a113b044692b61e6e91d920df4e", however as it might vary depending on the circumstances of each user, you can still extract it in the same manner. Now paste this password into the browser and hit the Continue button.

Administrator Password

There will be a choice to "Install suggested plugins" on the screen.

Install Suggested Plugins

A screen asking for the username, password, and email to create a new user will display after the suggested plugins have been installed completely. Fill in all the fields before clicking the "Save and Continue" button.

Create First Admin User

When it is completed, click the "Save and Finish" button on the Instance Configuration screen that will appear.

Instance Configuration

Now that the Jenkin is ready, a screen will appear; click the "Start using Jenkins" button.

Start using Jenkins

It displays the Jenkins environment.

Welcome to Jenkins

Using the following command will remove Jenkins from Debian 11:

 sudo apt purge jenkins -y

FAQ's on how to install jenkins on debian 11

What are the system requirements for Jenkins on Debian 11? 

Jenkins has minimal requirements, but it is recommended to have sufficient memory and disk space based on your workload.

How can I install Java on Debian 11 for Jenkins? 

You can install OpenJDK or Oracle JDK using the package manager apt. Refer to the official Debian documentation for the detailed installation process.

What is the official package repository for Jenkins on Debian? 

The official package repository for Jenkins on Debian is the Jenkins CI repository.

How do I add the Jenkins CI repository to Debian 11? 

First, import the Jenkins CI repository GPG key, and then add the repository to your system's package sources by using the echo command to add the repository line to the sources.list file.

How do I install Jenkins from the Jenkins CI repository? 

After adding the Jenkins CI repository, use the package manager apt to install Jenkins.

How can I secure the Jenkins web interface with SSL/TLS?

You can configure SSL/TLS for Jenkins by using a reverse proxy server like Nginx or Apache. Refer to the Jenkins documentation for detailed instructions.

Can I change the default port for Jenkins?

Yes, you can change the default port by modifying the Jenkins configuration file located at /etc/default/jenkins.

Conclusion

Jenkins is a server with many plugins and extensions that can make it easier for developers to create software and applications for various reasons.

This tutorial provided answers to frequently asked questions regarding the installation of Jenkins on Debian 11.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.