Score:0

How to get Redhat/Centos to run nogpgcheck automatically on any call to yum install?

in flag

I'm taking over a big project. 5 engineers worked on it for some years, but they are gone now. There are multiple install scripts, and they are very complicated. Somewhere inside of those scripts, they have commands such as:

yum install postgresql10

Which gives me the error:

Error: Failed to download metadata for repo 'pgdg-common': repomd.xml GPG signature verification error: Bad GPG signature

If I was running this on the command line, I could simply do:

dnf install -y --nogpgcheck  https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

I ran this command and it worked great.

Here is the problem: the install scripts die when they run into that error. I need to get around that somehow.

Is there a way to get yum to automatically run --nogpgcheck on every call of yum install?

You might think "Just grep the install scripts and then change the individual lines." But I cannot do that because the commands are full of variables and other junk, so I cannot grep for anything as clear and straightforward as "yum install". Some of the install commands are constructed over several lines.

How do I turn off the gpgcheck on all yum calls?

cn flag
Bob
You're attempting to fix the wrong thing. Your question should be, ***"How do I add the correct GPG key so the*** `GPG signature verification error: Bad GPG signature` ***error goes away?"*** so that you will still be able to validate signatures and prevent the installation of corrupted packages.
Score:1
ng flag

Why you want to disable gpg check by default, GPG check exists with purpose and my suggestion is to not try to skip it, but instead to fix it. And the real answer is yes, you can edit .repo files in yum repo dir /etc/yum.repos.d, for each repo there you have a option gpgcheck=1 just set it to 0 and you should be good to go.

If you want to do it for all, you can do it like so:

sudo sed -i 's/gpgcheck=1/gpgcheck=0/g' *
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.