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

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…

1 day ago

git cherry-pick Command: Apply Commits from Another Branch

Sometimes the change you need already exists, just on the wrong branch. A hotfix lands…

1 day ago

Best Email APIs for Secure Business Email: Why Developers Are Moving Beyond SMTP

Email is still one of the most important communication channels inside modern applications. Password resets,…

2 days ago

Nginx Commands in Linux: Start, Stop, Reload, Test, and Log

Nginx is a high-performance web server and reverse proxy trusted by some of the largest…

5 days ago

ufw Command in Linux: Manage Firewall Rules with Examples

ufw (Uncomplicated Firewall) sits on top of iptables (or nftables on newer systems) and replaces…

5 days ago

who Command in Linux: Show All Logged-In Users and Sessions

When you share a server with a team or investigate unexpected activity, the first question…

5 days ago