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

rmmod Command in Linux: Remove Kernel Modules and Blacklisting

The rmmod command in Linux removes a loaded module from the running kernel. Because the kernel has…

8 hours ago

free Command in Linux: Check Memory Usage and Interpret Output

The free command in Linux gives you a quick summary of RAM and swap usage. It reads…

8 hours ago

diff Command in Linux: Compare Files and Create Patches

The diff command in Linux compares two text files line by line and shows the lines that…

8 hours ago

Flush DNS Cache on Windows, Linux, and macOS: Quick Commands

DNS cache is a temporary database your OS and browser build as you browse. Each time you visit a website, the domain-to-IP mapping is saved locally, cutting out the round trip to a remote DNS server on repeat visits. Stale entries are the most common reason to flush the DNS cache: a server moves to a new IP, but your OS or browser still routes to the old address. This guide covers how to clear the DNS cache on Windows, Linux, and macOS, and how to flush the separate cache stored inside Chrome and Firefox. Flush DNS Cache on Windows The command is the same on Windows 10, Windows 11, and earlier supported releases. Open Command Prompt with administrator privileges. Type cmd in the Windows search bar, right-click Command Prompt, and select Run as…

8 hours ago

Change User Password in Ubuntu: Command Line and GNOME GUI

Using a strong, unique password for every account is one of the most effective security…

1 day ago

Enable and Disable the Root Account in Ubuntu: Full Guide

Ubuntu locks the root account by default. New users often wonder what the root password…

1 day ago