Home

Installing Jenkins on Ubuntu 20.04

What is Jenkins?

Jenkins is the long-time open-source CI/CD server — Java-based, plugin-driven, and probably the most widely deployed self-hosted CI in the world. It's not the prettiest tool around, but it's flexible and well-supported, and it's still the default for plenty of teams. Let's get it installed on Ubuntu.

1. Install Java

Jenkins runs on the JVM. Install OpenJDK 11:

bash
apt install openjdk-11-jdk

Verify:

bash
java -version
bash
openjdk version "11.0.11" 2021-04-20OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

2. Add the Jenkins apt repo

bash
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

3. Install Jenkins

bash
apt updateapt install jenkins

Confirm it's running:

bash
systemctl status jenkins
bash
 jenkins.service - LSB: Start Jenkins at boot time     Loaded: loaded (/etc/init.d/jenkins; generated)     Active: active (exited) since Mon 2021-09-13 23:30:10 UTC; 9min ago

4. Open the firewall

Jenkins listens on port 8080. Open it:

bash
# allow only the 192.168.10.0/24 subnetufw allow proto tcp from 192.168.10.0/24 to any port 8080
bash
# or allow from anywhere (only do this on a trusted network)ufw allow 8080

5. First-run setup

Browse to http://<jenkins-ip>:8080.

Jenkins generates an initial admin password and writes it to disk. Read it:

bash
cat /var/lib/jenkins/secrets/initialAdminPassword
bash
fbeeda0cfc8c43ba8ef91eb84c1bc773

Paste it into the Unlock Jenkins screen and click Continue.

The next screen asks whether to install suggested plugins or pick your own.

Pick Install suggested plugins for a sensible starting set. Once they finish installing, Jenkins prompts you to create the first admin user.

Save and continue.

Jenkins is up and ready.

Forcing the UI to English

Jenkins picks UI language from your browser by default, which produces a partly-translated interface. To force English, install the Locale plugin and set the default:

bash
Manage Jenkins Manage Plugins Available

Once the Locale plugin is installed:

bash
Manage Jenkins Configure SystemDefault Language: en_US[x] Ignore browser preference and force this language for all users

After saving you'll always see English regardless of the browser locale.