DineshS
DineshS

Reputation: 213

Unable to install Jenkins on Ubuntu 20.04

I am trying to install Jenkins on my Ubuntu EC2 instance and I performed the following steps to install but couldn't install it.

$sudo apt update
$sudo apt install openjdk-8-jdk
$wget -q -O - https://pkg.jenkins.io/debian-stable/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'
$sudo apt update   <--------- (Here I am getting below error)

root@ip-172-31-44-187:~# sudo apt update

Ign:1 https://pkg.jenkins.io/debian-stable binary/ InRelease Err:2 https://pkg.jenkins.io/debian-stable binary/ Release Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate. Could not handshake: Error in the certificate verification. [IP: 151.101.154.133 443] Hit:3 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu focal InRelease Get:4 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB] Get:5 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB] Get:6 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB] Reading package lists... Done E: The repository 'http://pkg.jenkins.io/debian-stable binary/ Release' does not have a Release file. 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.**

Upvotes: 21

Views: 44815

Answers (9)

Darshan Rami
Darshan Rami

Reputation: 41

Since March 28,2023 Jenkins weekly release using new repository signing keys. Below mentioned commands help me to resolve this issue.

curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | 
sudo tee \ /usr/share/keyrings/jenkins-keyring.asc > /dev/null

echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null

sudo apt-get update

sudo apt-get install jenkins -y

Upvotes: 4

Subhash Yadav
Subhash Yadav

Reputation: 1

Please Follow these commands

sudo apt-get update
sudo apt install openjdk-8-jdk
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | apt-key add -
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > \
e>     /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins -y

Upvotes: -3

aderchox
aderchox

Reputation: 4074

As it might help some, none of the above solutions worked for me, but it was a silly mistake! *Please* read ALL the outputs. In my case, I'd missed an error a few lines above which indicated that I didn't have "curl" installed (!) on my Debian server. And so copy pasting the key installation lines from the Jenkins manual (which uses curl) didn't succeed, so all those unsecure errors in result.

Upvotes: 0

Hiren Parghi
Hiren Parghi

Reputation: 1895

I would like to correct the first answer provided. You need to run apt install Jenkins -y instead of apt get install jenkins -y. Running the below commands will fix your error. If you are not using root ensure that you add sudo before of all the below commands.

apt upgrade 

apt update

apt install jenkins -y

You will find out your jenkins is started using the below command.

service jenkins status

Upvotes: 1

I had the same problem with adding Jenkins repository on Ubuntu 18.04

add-apt-repository 'deb https://pkg.jenkins.io/debian-stable binary/'

Ign:5 https://pkg.jenkins.io/debian-stable binary/ InRelease Err:6 https://pkg.jenkins.io/debian-stable binary/ Release Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate. Could not handshake: Error in the certificate verification. [IP: 199.232.66.133 443] Hit:7 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease Reading package lists... Done E: The repository 'https://pkg.jenkins.io/debian-stable binary/ Release' does not have a Release file. 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.

For fixing this issue you need to install/update ca-certificates

sudo apt install ca-certificates

After that, you can successfully add the Jenkins repository

Upvotes: 4

duvva raghavendra
duvva raghavendra

Reputation: 7

Instead of upgrading every package with the apt-get upgrade, I used: sudo apt install ca-certificates And then: sudo apt-get update worked just fine

Upvotes: -3

spanky
spanky

Reputation: 1499

Instead of upgrading every package with apt-get upgrade, I used: sudo apt install ca-certificates

And then: sudo apt-get update worked just fine.

Upvotes: 28

Tapan Hegde
Tapan Hegde

Reputation: 1328

I was facing same issue when I tried to install jenkins in AWS ec2 instance (Ubuntu 20.04). Below steps helped me.

  1. Update Ubuntu packages and all installed applications
sudo apt-get update -y
sudo apt-get upgrade -y
  1. Next, Install JDK
sudo apt install openjdk-11-jdk -y
  1. Verify Java version
java -version
  1. Add gpg key for jenkins installation
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | apt-key add -
  1. Add the repository address to our /etc/apt/sources.list.d file
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > \
e>     /etc/apt/sources.list.d/jenkins.list'
  1. Update our package list again
sudo apt-get update -y
  1. Install Jenkins
sudo apt-get install jenkins -y

It worked like charm!

Upvotes: 16

Rakesh Irukula
Rakesh Irukula

Reputation: 156

Yeah , I had same problem with this from yesterday , I think this is after yesterday's new update in jenkins 2.303.2 Lts .

Just do , apt upgrade , apt update, apt get install jenkins -y .

It worked for me .

Upvotes: 13

Related Questions