0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

The GPG keys listed for the "MySQL 5.7 Community Server" repository are already installed but they are not correct for this package.

Posted at

はじめに

mysqlをインストールしたらGPGキーのエラーが出ました。

GPGキーはリポジトリから提供されるパッケージが正当なものであり、第三者によって改ざんされていないことを保証します。

MySQLのパッケージは作成者の秘密鍵で署名されています。
インストール時にパッケージマネージャー(yumやrpm)は公開鍵を使用してパッケージの署名を検証します。

以下の記事を参考にしました
https://qiita.com/ttabata/items/2f2a5996dd5612b78774

事象

mysql-serverのパッケージをインストールした

yum install mysql-server

エラー内容

Downloading packages:
warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-server-5.7.44-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql から鍵を取得中です。


The GPG keys listed for the "MySQL 5.7 Community Server" repository are already installed but they are not correct for this package.
Check that the correct key URLs are configured for this repository.


 Failing package is: mysql-community-server-5.7.44-1.el7.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

対応手順

mysql-community.repoのリポジトリのファイルを開き、mysql57のGPGキーを確認した

# less /etc/yum.repos.d/mysql-community.repo
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

最新のGPGキーをダウンロードしました

chatGPTに鍵の意味を聞いてみました。
「RPM-GPG-KEY-mysql-2023」のGPGキーは、MySQLリポジトリから提供されるパッケージの整合性と信頼性を確認するために使用される公開鍵です。この鍵は、パッケージがMySQLの公式リポジトリから提供されたものであり、改ざんされていないことを保証します。」

[root@localhost rpm-gpg]# pwd
/etc/pki/rpm-gpg
[root@localhost rpm-gpg]# wget https://repo.mysql.com/RPM-GPG-KEY-mysql-2023
--2024-05-23 20:41:55--  https://repo.mysql.com/RPM-GPG-KEY-mysql-2023
repo.mysql.com (repo.mysql.com) をDNSに問いあわせています... 23.47.146.211, 2600:140b:1a00:785::1d68, 2600:140b:1a00:7a9::1d68
repo.mysql.com (repo.mysql.com)|23.47.146.211|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 3175 (3.1K) [text/plain]
`RPM-GPG-KEY-mysql-2023' に保存中

100%[=======================================================================================================>] 3,175       --.-K/s 時間 0s

2024-05-23 20:41:55 (591 MB/s) - `RPM-GPG-KEY-mysql-2023' へ保存完了 [3175/3175]

mysql-community.repoのファイルを開き、mysql57のGPGキーを変更した
RPM-GPG-KEY-mysql-2023鍵を設定した

vi /etc/yum.repos.d/mysql-community.repo
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023

インストールできました

yum install mysql-server
インストール:
  mysql-community-libs.x86_64 0:5.7.44-1.el7   mysql-community-libs-compat.x86_64 0:5.7.44-1.el7   mysql-community-server.x86_64 0:5.7.44-1.el7

依存性関連をインストールしました:
  mysql-community-client.x86_64 0:5.7.44-1.el7    mysql-community-common.x86_64 0:5.7.44-1.el7    net-tools.x86_64 0:2.0-0.25.20131004git.el7
  perl.x86_64 4:5.16.3-299.el7_9                  perl-Carp.noarch 0:1.26-244.el7                 perl-Encode.x86_64 0:2.51-7.el7
  perl-Exporter.noarch 0:5.68-3.el7               perl-File-Path.noarch 0:2.09-2.el7              perl-File-Temp.noarch 0:0.23.01-3.el7
  perl-Filter.x86_64 0:1.49-3.el7                 perl-Getopt-Long.noarch 0:2.40-3.el7            perl-HTTP-Tiny.noarch 0:0.033-3.el7
  perl-PathTools.x86_64 0:3.40-5.el7              perl-Pod-Escapes.noarch 1:1.04-299.el7_9        perl-Pod-Perldoc.noarch 0:3.20-4.el7
  perl-Pod-Simple.noarch 1:3.28-4.el7             perl-Pod-Usage.noarch 0:1.63-3.el7              perl-Scalar-List-Utils.x86_64 0:1.27-248.el7
  perl-Socket.x86_64 0:2.010-5.el7                perl-Storable.x86_64 0:2.45-3.el7               perl-Text-ParseWords.noarch 0:3.29-4.el7
  perl-Time-HiRes.x86_64 4:1.9725-3.el7           perl-Time-Local.noarch 0:1.2300-2.el7           perl-constant.noarch 0:1.27-2.el7
  perl-libs.x86_64 4:5.16.3-299.el7_9             perl-macros.x86_64 4:5.16.3-299.el7_9           perl-parent.noarch 1:0.225-244.el7
  perl-podlators.noarch 0:2.5.1-3.el7             perl-threads.x86_64 0:1.87-4.el7                perl-threads-shared.x86_64 0:1.43-6.el7

置換:
  mariadb-libs.x86_64 1:5.5.68-1.el7

完了しました!
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?