Installing Jenkins on Ubuntu tells me "Package 'jenkins' has no installation candidate"

Edward Tanguay asked:

I need to install Jenkins on Ubuntu 20.4.1.

I’ve completed the following:

  • apt-get -y install openjdk-8-jdk (it’s Java 14.0.1)
  • wget -q -O - | apt-key add - (responds "OK")
  • sudo sh -c 'echo deb binary/ > /etc/apt/sources.list.d/jenkins.list' (file exists and has this one line in it)
  • sudo apt update, responds:
Hit:1 focal InRelease
Hit:2 focal-updates InRelease
Hit:3 focal-backports InRelease
Hit:4 focal-security InRelease
Ign:5 binary/ InRelease
Get:6 binary/ Release [2,044 B]
Get:7 binary/ Release.gpg [833 B]
Ign:7 binary/ Release.gpg
Reading package lists... Done
W: GPG error: binary/ Release: The following signatures couldn't 
be verified because the public key is not available: NO_PUBKEY FCEF32E745F2C3D5
E: The repository ' binary/ Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.      
N: See apt-secure(8) manpage for repository creation and user configuration details.
  • sudo apt install jenkins, responds:
[email protected]:~# sudo apt install jenkins
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package jenkins is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'jenkins' has no installation candidate

What do I have to do so that apt finds the Jenkins package so it can be installed?

My answer:

You’re following unofficial or out of date instructions.

Because of this, you imported the wrong GPG key. Jenkins changed their GPG key on 16 April 2020. You need to import the correct key following the current official directions.

wget -q -O - | sudo apt-key add -

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.