How to automatically accept epel gpg key

The reason yum is asking for a key is that it is not present in /etc/pki/rpm-gpg

ls /etc/pki/rpm-gpg/ | column
RPM-GPG-KEY-CentOS-6        RPM-GPG-KEY-CentOS-Security-6    RPM-GPG-KEY-CentOS-Debug-6
RPM-GPG-KEY-CentOS-Testing-6    RPM-GPG-KEY-puppetlabs

You can import the key in one of 4 ways:

  1. use rpm --import http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6 (as suggested by slm)

  2. Install a package and then wait for the prompt (like I was doing)

  3. Use the RPM package provided by epel, it installs the repo and the key simultaneously.

    sudo yum -y install http://mirror.pnl.gov/epel/6/i386/epel-release-6-8.noarch.rpm"

  4. Manually copy the key to the right directory.


Any repository worth its salt will sign the RPMs that it delivers. The key used to confirm the signing of the RPMs is what you're downloading and installing this first time.

Without this key it would be impossible to guarantee the authenticity of the RPMs from a given repository, so this is a extremely important feature that should not be quickly dismissed as annoying.

If you want to automatically install the key you can try installing the key directly, prior to installing any RPMs from a repository like so:

$ rpm --import <url>

-or-

$ yum -y ...

Examples

$ sudo rpm --import \
    http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6 

Or you could try setting the option to yum to assume yes:

$ yum -y install redis

You could also download these files manually and put them in this directory, /etc/pki/rpm-gpg/. The next time yum or rpm runs they'll pick these files up that are present here.

References

  • GPG KEYS USED BY FEDORA PROJECT