Thay đổi GPG key cho AlmaLinux 8

Vào tháng 01/2024, AlmaLinux 8 đã chuyển sang sử dụng GPG key mới cho việc quản lý các gói cài đặt của mình.

Nếu VPS hoặc Cloud Server của bạn vẫn đang sử dụng GPG key cũ mà chưa update, bạn sẽ gặp phải lỗi “GPG check FAILED” như phía dưới khi update OS hoặc cài đặt các gói.

Zhost Tutorial
Importing GPG key 0xC21AD6EA:
 Userid     : "AlmaLinux "
 Fingerprint: E53C F5EF 91CE B0AD 1812 ECB8 51D6 647E C21A D6EA
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Is this ok [y/N]: y
Zhost Tutorial
Key imported successfully
Import of key(s) didn't help, wrong key(s)?
Public key for platform-python-devel-3.6.8-56.el8_9.3.alma.1.x86_64.rpm is not installed. Failing package is: platform-python-devel-3.6.8-56.el8_9.3.alma.1.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for qemu-guest-agent-6.2.0-40.module_el8.9.0+3714+46544554.2.x86_64.rpm is not installed. Failing package is: qemu-guest-agent-15:6.2.0-40.module_el8.9.0+3714+46544554.2.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for NetworkManager-1.40.16-13.el8_9.alma.1.x86_64.rpm is not installed. Failing package is: NetworkManager-1:1.40.16-13.el8_9.alma.1.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for NetworkManager-config-server-1.40.16-13.el8_9.alma.1.noarch.rpm is not installed. Failing package is: NetworkManager-config-server-1:1.40.16-13.el8_9.alma.1.noarch
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for NetworkManager-libnm-1.40.16-13.el8_9.alma.1.x86_64.rpm is not installed. Failing package is: NetworkManager-libnm-1:1.40.16-13.el8_9.alma.1.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for NetworkManager-team-1.40.16-13.el8_9.alma.1.x86_64.rpm is not installed. Failing package is: NetworkManager-team-1:1.40.16-13.el8_9.alma.1.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for NetworkManager-tui-1.40.16-13.el8_9.alma.1.x86_64.rpm is not installed. Failing package is: NetworkManager-tui-1:1.40.16-13.el8_9.alma.1.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for platform-python-3.6.8-56.el8_9.3.alma.1.x86_64.rpm is not installed. Failing package is: platform-python-3.6.8-56.el8_9.3.alma.1.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for python3-libs-3.6.8-56.el8_9.3.alma.1.x86_64.rpm is not installed. Failing package is: python3-libs-3.6.8-56.el8_9.3.alma.1.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for python3-urllib3-1.24.2-5.el8_9.2.noarch.rpm is not installed. Failing package is: python3-urllib3-1.24.2-5.el8_9.2.noarch
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for sqlite-3.26.0-19.el8_9.x86_64.rpm is not installed. Failing package is: sqlite-3.26.0-19.el8_9.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for sqlite-devel-3.26.0-19.el8_9.x86_64.rpm is not installed. Failing package is: sqlite-devel-3.26.0-19.el8_9.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for sqlite-libs-3.26.0-19.el8_9.x86_64.rpm is not installed. Failing package is: sqlite-libs-3.26.0-19.el8_9.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for xfsdump-3.1.8-7.el8_9.x86_64.rpm is not installed. Failing package is: xfsdump-3.1.8-7.el8_9.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'yum clean packages'.
Error: GPG check FAILED

Để khắc phục lỗi này, bạn có thể update GPG key mới bằng cách SSH vào Server của bạn, và import key bằng lệnh:

Zhost Tutorial
rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux

Sau đó chạy lệnh sau để kiểm tra:

Zhost Tutorial
rpm -q gpg-pubkey-ced7258b-6525146f

Nếu màn hình hiển thị ra gpg-pubkey-ced7258b-6525146f tức là đã import thành công.

Bạn có thể Update OS và cài đặt các gói như bình thường.

Zhost chúc bạn thành công!