Unable to install jenkins on ubuntu - jenkins

When i write [sudo apt-get update]
First error : https://pkg.jenkins.io/debian-stable binary/ Packages
server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
Second error : W: The repository 'http://pkg.jenkins.io/debian-stable binary/ Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch https://pkg.jenkins.io/debian-stable/binary/Packages server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
E: Some index files failed to download. They have been ignored, or old ones used instead.

Try adding a '[trusted=yes]' tag in your /etc/apt/sources.list (or sources.list.d/file) file at the line related to http://pkg.jenkins.io/debian-stable...
At the end, in your souces.list file, you should end up with something like the following:
deb [trusted=yes] http://pkg.jenkins.io/.....
EDIT: this shell command should do the trick:
sed -i 's/^deb /deb [trusted=yes] /' /etc/apt/sources.list
then reload your apt cache with:
apt update
Hope it helps.

Follow Jenkins Debian Packages for all the commands to install Jenkins in Ubuntu.
Install Java
Update your local package index
sudo apt-get install jenkins
I have installed it on Ubuntu 22.04.1 LTS and created a Video Tutorial of it.

Related

Gitlab jobs failling (sudo: command not found OR Failed to fetch)

I am using Gitlab Jobs to deploy a tool. The code below returns sudo: command not found. If I remove the sudo I get the following:
W: Failed to fetch http://deb.debian.org/debian/dists/stable/InRelease Could not connect to deb.debian.org:80 (199.232.138.132), connection timed out
W: Failed to fetch http://security.debian.org/debian-security/dists/stable-security/InRelease Could not connect to security.debian.org:80 (151.101.130.132), connection timed out Could not connect to security.debian.org:80 (151.101.66.132), connection timed out Could not connect to security.debian.org:80 (151.101.2.132), connection timed out Could not connect to security.debian.org:80 (151.101.194.132), connection timed out
W: Failed to fetch http://deb.debian.org/debian/dists/stable-updates/InRelease Unable to connect to deb.debian.org:80:
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package latex209-bin
E: Unable to locate package texlive-latex-base
E: Unable to locate package texlive-latex-extra
E: Unable to locate package ant
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
This is the .gitlab-ci.yml file:
stages:
- deploy
variables:
RA_NAME: "My_project"
default:
before_script:
- sudo apt-get update -qq && sudo apt-get install -y latex209-bin texlive-latex-base texlive-latex-extra ant && sudo apt-get install zip unzip
deploy_Default:
stage: deploy
script:
- sh -x deploy.sh "$RA_NAME" "$(cat RA_VERSION)"
artifacts:
paths:
- "${RA_NAME}_$(cat RA_VERSION).zip"
only:
- master
- dev
- tags
This has been happening for 1 week (most likely from the Gitlab 15.0 release).
Every Job before this started to happen Passed without any problems. Now, without changing anything they all fail (even trying to rerun old ones that Passed).
I tried adding
build_image:
script:
- docker build --network host
and a couple of similar configurations but none of them worked.
Now my question: why sudo doesn't work anymore without changing anything on my .gitlab-ci.yml and what can I do to solve it.
I should mention that these Jobs are triggered by commits to the branches mentioned in only. I can run them by running pipeline or rerun the ones that were already run. I am not aware of any other modality to run them. All the work with Gitlab and this Docker are done by Gitlab UI
This happens when the instance/server has networking issues. If the runner isn't self-hosted then Gitlab should fix the problem fairly soon. If the runner is self-hosted then you've got networking issues. Here's what I can propose:
Note: Try this without sudo
Select the debian mirror close to you from the debian mirror sites list
Edit the sources list via nano /etc/apt/sources.list if nano is not available then use vi
Change to a different mirror
For example
http://deb.debian.org/debian/dists/stable/InRelease // <-- remove this
http://ftp.us.debian.org/debian/dists/stable/InRelease // <-- add this
Save.
I solved the problem. Before the update, without specifying any image in .gitlab-ci.yml, by default it used my company Docker Image . After the update I noticed it used another one
I added to my .gitlab-ci.yml the following:
image: myCompanyImage
and now works fine as before.
If you encounter such a problem, check the image it's using and the image used in a previous successfully run pipeline.

Errno 14 HTTPS Error 301 - Moved Permanently while installing Jenkins - yum install jenkins

[root####~]# yum install jenkins
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
base: mirror.myfahim.com
extras: centos-hcm.viettelidc.com.vn
updates: mirror.tino.org
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
http://pkg.jenkins.io/redhat-stable/repodata/repomd.xml: [Errno 14] HTTPS Error 301 - Moved Permanently
Trying other mirror.
One of the configured repositories failed (Jenkins-stable),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=jenkins ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable jenkins
or
subscription-manager repos --disable=jenkins
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=jenkins.skip_if_unavailable=true
failure: repodata/repomd.xml from jenkins: [Errno 256] No more mirrors to try.
http://pkg.jenkins.io/redhat-stable/repodata/repomd.xml: [Errno 14] HTTPS Error 301 - Moved Permanently
Please help me out
It looks like the jenkins.repo file currently distributed by jenkins.io, is configured to use http, not https. (C'mon, people, seriously? This is 2021.) Fortunately it's very easy for you to edit /etc/yum.repos.d/jenkins.repo to change it to https. Unfortunately, that's not where the problems stop, at least on RHEL 7.9, the root issuer (Let's Encrypt R3) is not in the trusted cert store by default. You can verify that the jenkins.io cert is actually valid by using a service such as https://www.ssllabs.com/ssltest/analyze.html?d=pkg.jenkins.io. The cert and chain is actually valid, but the issuer is R3, which is trusted by everyone else (Mozilla, Apple, Android, Java, Microsoft), but is not trusted by yum. To resolve this issue (after Sep 24, 2021) you need to update ca-certificates
yum upgrade ca-certificates
I have found a solution for this error.
edit your /etc/yum.repos.d/jenkins.repo file from
[jenkins]
name=Jenkins
baseurl=http://pkg.jenkins.io/redhat
gpgcheck=1
to
[jenkins]
name=Jenkins
baseurl=https://pkg.jenkins.io/redhat
gpgcheck=1
Try to yum update.
It will probably return an SSL error.
If so, edit your /etc/yum.conf , add this line:
sslverify=false
Now it should work.
Remember to set sslverify to true again if you don't want self-signed certificates to work on your yum.
I have found a solution for this error.
ALL REPOS URL MUST HTTPS.
HTTP -> HTTPS
edit all your /etc/yum.repos.d/REPONAMES.repo file from
[repo]
name=Jenkins
baseurl=http://pkg.jenkins.io/redhat
gpgcheck=1
to
[repo]
name=Jenkins
baseurl=https://pkg.jenkins.io/redhat
gpgcheck=1
Try to yum update. It will probably return an SSL error. If so, edit your /etc/yum.conf , add this line:
sslverify=false
Now it should work.
Remember to set sslverify to true again if you don't want self-signed certificates to work on your yum.

Centos image build fails when I use rpms via docker

I'm currently working out a Dockerfile. So I am trying to build out a Centos 7.6 base image and I get a failure when I try to use any yum packages. I'm not sure what the cause of this is.
I've already attempted to make the user root to see if that makes a difference but it doesn't help the situation. I've also done a docker pull centos to recieve the latest version of centos.
I simplified the code and still the same error.
FROM centos
ARG MONGO-RAILS-VERSION="0.0"
RUN yum install vim
# curl -L get.rvm.io | bash -s stable \
# rvm install 2.3.1 \
# rvm use 2.3.1 --default \
# gem install rails
I get an error that looks something like this
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=<repoid> ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable <repoid>
or
subscription-manager repos --disable=<repoid>
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container error was
14: curl#7 - "Failed to connect to 2001:1b48:203::4:10: Network is unreachable"
The command '/bin/sh -c yum install vim' returned a non-zero code: 1
You may want to have a look for Set build-time variables (--build-arg):
$ docker build --build-arg HTTP_PROXY=http://10.20.30.2:1234 --build-arg FTP_PROXY=http://40.50.60.5:4567 .

error while installing neo4j in ubuntu

I have installed ubuntu 16.04 LTS.
I am trying to install neo4j but I am getting the following
W: GPG error: http://debian.neo4j.org/repo stable/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 26C95CF201182252
W: The repository 'http://debian.neo4j.org/repo stable/ Release' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Reading package lists... Done
......What to do?
Be sure to follow the documentation: you missed the first step,
wget -O - https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add -
Then, re-run sudo apt-get update.

E: Unable to locate package heroku-toolbelt

I am trying to install the Heroku Toolbelt on Linux Mint 15 Olivia (x86-64)
When i try to run the standard command for installing on Debian machines:
wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
I get:
W: Failed to fetch http://toolbelt.heroku.com/ubuntu/./Packages 302 Moved Temporarily [IP: 23.21.198.2 80]
...
E: Unable to locate package heroku-toolbelt
I have also got the heroku.list repo in my etc/apt/sources/:
deb http://toolbelt.heroku.com/ubuntu ./
When i try to add the repo again with:
sudo apt-add-repository 'deb http://toolbelt.herokuapp.com/ubuntu ./'
I get:
Cannot add PPA: 'No JSON object could be decoded'.
And it seems i'm not the first person with this error on Mint 15 while trying to add repositories.
I suspect this issue may indeed be temporary, but if you need the heroku toolbelt installed now, you can install the standalone client instead of the ubuntu/debian bundle.
wget -qO- https://toolbelt.heroku.com/install.sh | sh
On an Ubuntu-based distro, however, the above will likely throw some errors:
sh: 7: [[: not found
sh: 29: [[: not found
Installation complete
This is because on Ubuntu systems /bin/sh is dash, not bash. You could either get the script and modify it to use bash instead of sh (sh is called within the script, just changing sh to bash in the command above won't suffice), or, you could ignore the errors and just do what the error-ing portion of the script instructs you to do:
Add the Heroku CLI to your PATH using:
echo 'PATH="/usr/local/heroku/bin:$PATH"' >> ~/.profile
You'll need to logout/login again to register the path addition, or just execute heroku directly in the mean time:
/usr/local/heroku/bin/heroku

Resources