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

Install Pip on Ubuntu 18.04: Python 3 and Python 2 Setup Guide

Pip is the official package manager for Python and the standard way to install libraries from…

1 hour ago

Install R on Ubuntu 18.04 from CRAN: Statistical Computing Setup

R is an open-source programming language and environment built for statistical computing and data visualization. It…

1 hour ago

Install Android Studio on Ubuntu 18.04 with Snap and OpenJDK 8

Android Studio is the official IDE for Android development, built on JetBrains' IntelliJ IDEA platform. It…

2 hours ago

Install and Configure GitLab on Ubuntu 18.04 with Omnibus

GitLab is a web-based, open-source Git repository manager written in Ruby. It includes built-in tools for…

2 hours ago

Install Anaconda on Ubuntu 18.04: Python Data Science Setup Guide

Anaconda is the most widely used Python distribution for data science and machine learning. It bundles…

24 hours ago

Install WordPress on Ubuntu 18.04 with Nginx and PHP 7.2

WordPress is the most popular open-source CMS in the world, powering over 40% of all websites…

1 day ago