Fix that jenkins installation issue

It can a bit of a hassle to get Jenkins to run on an EC2 instance running Ubuntu server. Since the advent of Jenkins LTS release 2.235.3, Adminstrators of Linux are advised to install the new signing keys on their Linux servers before installing Jenkins using the below commands:

jenkins.png

Debian/Ubuntu

wget -qO - pkg.jenkins.io/debian-stable/jenkins.io.key | apt-key add -

Red Hat/CentOS

rpm --import pkg.jenkins.io/redhat-stable/jenkins.io.key

Updates will be blocked by the operating system package manager (apt, yum, dnf) on operating systems that have not installed the new repository signing key.

For more information visit https://www.jenkins.io/blog/2020/07/27/repository-signing-keys-changing/ or check the official documentation for Jenkins

Install Jenkins on Linux:

Java is one of the requirements to run Jenkins on a Linux distribution such as ubuntu but not all distributions include this by default

To install the Open Java Development Kit (OpenJDK) run the following:

Update the repositories

sudo apt update

sudo apt-get install openjdk-11-jdk -y

java -version

To install Jenkins

wget -q -O - pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -

sudo sh -c 'echo deb pkg.jenkins.io/debian-stable binary/ >
/etc/apt/sources.list.d/jenkins.list'

sudo apt-get update sudo apt-get install jenkins

run :port i.e 192.168.7.3:8080

If you experience errors during installation such as 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

Chances are that you are running $ wget -q -O — pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -

instead of

wget -q -O - pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -

Comment below. Let me know if this worked for you!