Choose a different version or distribution
Introduction
Before we start talking about how to install Jenkins on Debian 12, 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 12. We will also address a few FAQs on how to install Jenkins on Debian 12.
Advantages
- Automation: Jenkins automates various stages of the software development lifecycle, such as building, testing, and deploying applications.
- Integration: Jenkins seamlessly integrates with a wide range of development tools, including version control systems, build tools, and testing frameworks.
- 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.
- Scalability: Jenkins is designed to handle small to large environments, enabling you to scale your CI/CD pipelines as your project and team grow.
- Community Support: Jenkins has a large and active community.
How to Install Jenkins on Debian 12
Before installing any packages, it is advised to update the Debian 12 repository. To do this, run the following 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 12:
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
When the GPG key is imported, the message "OK" will show. When this occurs, import the source repository from Jenkins' official website using the following command:
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 12 repository, update the Debian 12 repository once more.
sudo apt update
Use the following command to now install the Jenkins:
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://instance-IP:8080
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.
There will be a choice to "Install suggested plugins" on the screen.
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.
When it is completed, click the "Save and Finish" button on the Instance Configuration screen that will appear.
Now that the Jenkins is ready, a screen will appear; click the "Start using Jenkins" button.
It displays the Jenkins environment.
Using the following command will remove Jenkins from Debian 12:
sudo apt purge jenkins -y
FAQ's on How to Install Jenkins on Debian 12
Can I install Jenkins manually on Debian 12 instead of using the package manager?
Yes, you can install Jenkins manually on Debian 12 by downloading the Jenkins WAR file and running it with Java. This method provides more flexibility but requires additional setup steps.
Can I install plugins for Jenkins on Debian 12?
Yes, you can install additional plugins for Jenkins on Debian 12. Through the Jenkins web interface, navigate to "Manage Jenkins" > "Manage Plugins" and install the desired plugins from the available list.
Does Jenkins automatically start on boot after installation on Debian 12?
Yes, Jenkins is automatically configured to start on boot after installation on Debian 12. The Jenkins service is managed by the init system, ensuring automatic startup.
How can I configure Jenkins to use an alternative port on Debian 12?
To configure Jenkins to use a different port on Debian 12, modify the /etc/default/jenkins
file and update the HTTP_PORT
parameter to the desired port number. Save the file and restart the Jenkins service for the changes to take effect.
Are there any additional steps required to configure Jenkins on Debian 12 after installation?
Yes, after installing Jenkins on Debian 12, you need to unlock Jenkins by retrieving the initial administrator password from the server's file system. Follow the instructions displayed on the console during the first-time setup.
How can I access the Jenkins web interface after installation on Debian 12?
By default, the Jenkins web interface can be accessed using http://localhost:8080
in a web browser on the same machine where Jenkins is installed. If accessing from a remote machine, replace localhost
with the IP address or hostname of the Jenkins server.
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 12.
If you have any queries, please leave a comment below, and we’ll be happy to respond to them.