Always show "rpm --import public.gpg.key" when using dnf command

Solution Verified - Updated -

Issue

  • Always show rpm --import public.gpg.key when using dnf command
    e.g.
# dnf install vim
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.


You have enabled checking of packages via GPG keys. This is a good thing.
However, you do not have any GPG public keys installed. You need to download
the keys for packages you wish to install and install them.
You can do that by running the command:
    rpm --import public.gpg.key


Alternatively you can specify the url to the key you would like to use
for a repository in the 'gpgkey' option in a repository section and DNF
will install it for you.

For more information contact your distribution or package provider.

Problem repository: [Baseos]
bandwidth: 0
baseurl: file:///mnt/iso/BaseOS/
cachedir: /var/cache/dnf
cost: 1000
countme: 0
deltarpm: 1
deltarpm_percentage: 75
enabled: 1
enabled_metadata:
enablegroups: 1
exclude:
excludepkgs:
failovermethod: priority
fastestmirror: 0
gpgcheck: 1
gpgkey:
includepkgs:
ip_resolve: whatever
max_parallel_downloads: 3
mediaid:
metadata_expire: 172800
metalink:
minrate: 1000
[Baseos]
mirrorlist:
module_hotfixes: 0
name: baseos-rhel8u8
password:
priority: 99
protected_packages: dnf, redhat-release, setup, dnf, systemd, systemd-udev, yum, sudo, redhat-release, setup, dnf, systemd, systemd-udev, yum, sudo
proxy:
proxy_auth_method: any
proxy_password:
proxy_sslcacert:
proxy_sslclientcert:
proxy_sslclientkey:
proxy_sslverify: 1
proxy_username:
repo_gpgcheck: 0
retries: 10
skip_if_unavailable: 0
sslcacert:
sslclientcert:
sslclientkey:
sslverify: 1
sslverifystatus: 0
throttle: 0
timeout: 30
type:
user_agent: libdnf (Red Hat Enterprise Linux 8.9; generic; Linux.x86_64)
username:

Environment

  • Red Hat Enterprise Linux 8

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content