How To

Install Jenkins on Ubuntu 18.04: CI/CD Server Setup Guide

Jenkins is an open-source automation server that makes it easy to build CI/CD pipelines. Continuous integration (CI) means team members commit code changes frequently, and automated builds and tests run after each commit to catch problems early. Continuous delivery (CD) takes that a step further by automatically building, testing, and preparing code for production deployment.

Jenkins handles both and integrates with nearly every tool in the DevOps ecosystem, from Git and Docker to Kubernetes and Slack.

This guide shows you how to install Jenkins on Ubuntu 18.04 using the official Jenkins Debian package repository. The same steps work on Ubuntu 16.04.

<strong>Prerequisite:</strong>&nbsp;You need sudo access.

Install Jenkins on Ubuntu: Java, Repository, and Package Setup

Install Java 8. Jenkins is a Java application and requires OpenJDK 8. The current Jenkins release does not support Java 10 or 11, so use Java 8 specifically:

bashsudo apt updatesudo apt install openjdk-8-jdk

Add the Jenkins Debian repository. Import the Jenkins GPG key so your system trusts packages from the Jenkins repository:

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

The command prints OK when the key is imported successfully. Add the Jenkins repository to your apt sources:

bashsudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ &gt; /etc/apt/sources.list.d/jenkins.list'

Install Jenkins. Update the package list and install the latest stable release:

bashsudo apt updatesudo apt install jenkins

Jenkins starts automatically after installation. Confirm it is running:

bashsystemctl status jenkins

Look for Active: active (exited) in the output. Jenkins runs as a service managed by systemd.

Open the Firewall and Access the Jenkins Setup Wizard

Open port 8080. Jenkins listens on port 8080 by default. Allow it through UFW:

bashsudo ufw allow 8080

Open your browser and go to http://your_ip_or_domain:8080. Jenkins shows an unlock screen asking for the initial administrator password. Retrieve it with:

bashsudo cat /var/lib/jenkins/secrets/initialAdminPassword

Copy the 32-character string it prints, paste it into the Administrator password field, and click Continue.

Install Plugins and Create the Admin User

Jenkins asks whether to install suggested plugins or choose your own. Click Install suggested plugins. The suggested set includes support for Git, pipelines, Gradle, Maven, and workspace management. These cover most use cases and are the right choice for a standard Jenkins setup. The installation runs automatically.

Once plugins are installed, you are prompted to create the first administrator account. Fill in your username, password, full name, and email address. Click Save and Continue.

On the next screen, confirm the Jenkins URL, it is pre-filled with the current address. Click Save and Finish.

Click Start using Jenkins and you land on the Jenkins dashboard as the admin user you just created. From here, you can create your first pipeline job and connect it to a code repository.

Jenkins is now installed and running on your Ubuntu 18.04 server. Visit the Jenkins documentation to learn how to set up pipelines, manage credentials, and integrate with your version control system. Leave a comment below if you run into any issues.

Cyber Defence

Recent Posts

What Is a Data Protection Platform and Why Your Organization Needs One

A data protection platform is a unified system that helps organizations discover, classify, monitor, and…

3 weeks ago

How Swiss Privacy Rules Affect AI Companies Under GDPR

AI companies operating in or around Switzerland face a compliance challenge that most legal teams…

3 weeks ago

Swiss FADP vs EU GDPR: Key Differences for AI and Data Privacy

Two major data privacy laws now govern how organizations handle personal data across Europe; the…

3 weeks ago

Kali Linux Commands Cheat Sheet: Complete Quick Reference

This cheat sheet covers the essential Kali Linux commands every pentester and ethical hacker uses…

2 months ago

What I Wish I Knew Before Learning Malware Analysis and Reverse Engineering

When I first started learning malware analysis and reverse engineering, I thought the hardest part…

2 months ago

git fetch vs git pull: How They Work and When to Use Each

Both git fetch and git pull talk to a remote repository, but they do very different things to your…

2 months ago