How to install Jenkins on Ubuntu 20.04 by example

Jenkins Ubuntu 20.04 install

In April of 2020, Ubuntu released Focal Fossa, the latest LTS version of the popular Linux distribution.

As such, DevOps developers interested in taking advantage of the latest Ubuntu features in their CI builds are looking at performing an Jenkins installations of Ubuntu 20.04, which is exactly the focus of this tutorial.

The only prerequisite for a Jenkins install on Ubuntu 20.04 is a JDK installation that does not predate Java 8. The latest LTS Java release is version 11, however, a number of developers who install Jenkins on Ubuntu with Java 11 have run into the dreaded Failed to start LSB: Start Jenkins at boot time error. As a result, this tutorial reluctantly performs the install and configuration with the AdoptOpenJDK distribution of Java 8.

How to install Jenkins on Ubuntu 20.04

The steps followed and the commands used to install Jenkins on Ubuntu 20 are as follows:

  1. sudo apt-get update
  2. sudo apt-get install openjdk-8-jdk
  3. wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
  4. sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
  5. sudo apt-get update
  6. sudo apt-get install jenkins
  7. sudo apt install git

Note that a Git install is not a requirement for Jenkins on Ubuntu 20.04, but without some mechanism to pull source code, Jenkins is pretty useless. So Git was installed as well.

Your intro to GitHub Actions training course

Here’s how to get started with GitHub Actions:

Follow these tutorials to learn GitHub Actions fast.

Jenkins post-installation steps on Ubuntu 20.04

After the Jenkins installation shell commands complete, the CI/CD tool will be automatically started and is accessible on localhost:8080. There are a few post-installation steps to complete before the Jenkins CI tools is usable, namely:

  • Provide the secret hexadecimal key Jenkins has planted on Ubuntu to help verify your identify
  • Choose which Jenkins plugins to install. The default set of plugins are selected in this tutorial
  • Create an administrative user account. A user named jenkins is used in this example.
Install Jenkins Ubuntu 20

One of the post-installation steps with Jenkins on Ubuntu 20.04 is to provide a hex key to prove your identity.

After the Jenkins post-installation steps are complete, create a simple Hello World Jenkins job just to prove that everything is working successfully.

Jenkins and Ubuntu build tools

Furthermore, Jenkins needs a good build tool such as Maven, Gradle or even Ant in order to be useful. Theoretically, you could always build your Java code and run JUnit tests with basic JDK tools, but doing so would be a complete waste of time. A subsequent tutorial demonstrates how to integrate Jenkins with these aforementioned build tools.

Of course, if you’re really clever and want to play the Jenkins and Ubuntu game on expert level, just install Docker. That way you don’t have to install any build tools locally. Just use various Docker images that have Maven, Gradle, Sonarqube or Nexus pre-configured. A subsequent tutorial demonstrates how to make that Jenkins and Docker integration happen.

But for now, if you can get the JDK installed, Git configured a a simple Jenkins job running on Ubuntu 20.04, you can take solace in the fact that you are one step closer to dominating the DevOps world.

App Architecture
Software Quality
Cloud Computing
Security
SearchAWS
Close