How to Install Jenkins on Debian 9 Stretch Linux

Objective

The objective is to install Jenkins on Debian 9.

Operating System and Software Versions

  • Operating System: – Debian 9 Stretch
  • Software: – Jenkins 2.46.3

Requirements

Privileged access to your Debian system will be required.

Difficulty

EASY

Conventions

  • # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
  • $ – requires given linux commands to be executed as a regular non-privileged user

Instructions

Inlcude Jenkins APT repository

First step is to include Jenkins APT repository and key. Let’s start by adding a new key:

# wget -q -O - http://pkg.jenkins-ci.org/debian-stable/jenkins-ci.org.key | apt-key add 
OK

Next, add a repository. Here we have two options. First, we can add a stable LTS Jenkins repository:

# echo "deb http://pkg.jenkins-ci.org/debian-stable binary/" > /etc/apt/sources.list.d/jenkins.list

Another option is to inlcude latest Jenkins version repository:



# echo "deb http://pkg.jenkins-ci.org/debian binary/" > /etc/apt/sources.list.d/jenkins.list

With that done, update repository index:

# apt update

Install Jenkins

Now, that APT repositories are in place, the installation of Jenkins is rather simple one-liner:

# apt install jenkins

Access Jenkins

Jenkins is now installed. Rertieve your initial Jenkins password:

# cat /var/lib/jenkins/secrets/initialAdminPassword
b9b1649e223843e29cf17812a2322a3f

Once you have your password, navigate your browser to http://jenkins-server-IP:8080 and proceed with additional wizard customisation.

jenkins install debian stretch 9