In this tutorial, we will show you how to install Jenkins on your Debian 9 Stretch. For those of you who didn’t know, Jenkins is an open-source continuous integration tool written in Java. Jenkins provides continuous integration services for software development. It is a server-based system running in a servlet container such as Apache Tomcat. It supports SCM tools including AccuRev, CVS, Subversion, Git, Mercurial, Perforce, Clearcase, and RTC, and can execute Apache Ant and Apache Maven-based projects as well as arbitrary shell scripts and Windows batch commands.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Jenkins on a Debian 9 (Stretch) server.
- A server running one of the following operating systems: Debian 9 (Stretch).
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Jenkins on Debian 9 Stretch
Step 1. Before we install any software, it’s important to make sure your system is up to date by running the following
apt-get commands in the terminal:
apt-get update apt-get upgrade
Step 2. Installing Java.
Jenkins requires a minimum of Java 7, but you can also install Java 8 which is recommended by Jenkins:
apt-get install openjdk-8-jdk apt-transport-https
Verify Java installation by typing the command below:
Step 3. Installing Jenkins.
Add the key and source list to apt:
wget -q -O - http://pkg.jenkins-ci.org/debian-stable/jenkins-ci.org.key | sudo apt-key add -
Create a sources list for Jenkins:
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
After the cache has been updated, start to proceed with installation Jenkins:
sudo apt-get update sudo apt-get install jenkins
Start Jenkins service:
systemctl start jenkins
Jenkins will write log files to
/var/log/jenkins/jenkins.log. You can also fine-tune the configuration.
Step 4. Configure Firewall for Jenkins.
Configure the firewall so that you can access Jenkins:
firewall-cmd --permanent --add-port=8080/tcp firewall-cmd --reload
Step 5. Accessing Jenkins.
Jenkins will be available on HTTP port 8080 by default. Open your favorite browser and navigate to
http://server-ip:8080 and complete the required steps to finish the installation. If you are using a firewall, please open port 8080 to enable access to the control panel. The default installation password can be found at
/var/lib/jenkins/secrets/initialAdminPassword as shown in the below image.
Congratulations! You have successfully installed Jenkins. Thanks for using this tutorial for installing Jenkins on Debian 9 (Stretch) server. For additional help or useful information, we recommend you to check the official Jenkins website.