Jenkins is an open-source  automation server that offers an easy way to set up a continuous  integration and continuous delivery (CI/CD) pipeline.

Continuous  integration (CI) is a DevOps practice in which team members regularly  commit their code changes to the version control repository, after which  automated builds and tests are run. Continuous delivery (CD) is a  series of practices where code changes are automatically built, tested  and deployed to production.

In this tutorial, we will walk through installing Jenkins on a Debian 9 machine using the Jenkins Debian package repository.

Prerequisites

Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges.

Installing Jenkins

Follow the steps below to install Jenkins on a Debian system:

Jenkins  is a Java application, so first, you’ll need to install Java. To do so  update the package index and install the Java 8 OpenJDK package with the  following commands:

sudo apt update

The  current version of Jenkins does not support Java 10 (and Java 11) yet.  If you have multiple versions of Java installed on your machine make sure Java 8 is the default Java version.

Import the GPG keys of the Jenkins repository using the following wget command:

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -

The commands should return OK which means that the key has been successfully imported and the packages from this repository will be considered trusted.

Once the key is imported add the Jenkins repository to your system with:

sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

Update the apt package list and install the latest version of Jenkins by running:

sudo apt update

Start the Jenkins service and enable it to automatically start on boot:

sudo systemctl start jenkins

Setting Up Jenkins

Start the setup by opening your browser and typing your domain or IP address followed by port 8080, http://your_ip_or_domain:8080. A screen similar to the following will be displayed:

During  the installation, the Jenkins installer creates an initial 32-character  long alphanumeric password. To find the password type:

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

Copy the password, paste it into the Administrator password field and click Continue.

On the next screen, the setup  wizard will ask you whether you want to install suggested plugins or you  want to select specific plugins. Click on the Install suggested plugins box, and the installation process will start immediately.

Next, you will be prompted to set up the first admin user. Fill out the required information and click Save and Continue.

The next page will ask you to set  the URL for your Jenkins instance. The field will be populated with an  automatically generated URL.

Confirm the URL by clicking on the Save and Finish button and the setup process will be completed.

Click on the Start using Jenkins button and you will be redirected to the Jenkins dashboard logged in as  the admin user you have created in one of the previous steps.

At this point, you’ve successfully installed Jenkins on your system.

Conclusion

In  this tutorial, you have learned how to install and perform the initial  configuration of Jenkins. You can now start exploring Jenkins features  by visiting the official Jenkins documentation page.

If you have any questions, please leave a comment below.