
Giới thiệu
Trong quá trình sử dụng AlmaLinux 8, bạn có thể gặp tình trạng lỗi liên quan đến GPG Key khi cập nhật hệ thống hoặc cài đặt phần mềm thông qua dnf/yum, chẳng hạn như lỗi GPG key verification failed, Public key is not installed hoặc repository bị từ chối xác thực.
Nguyên nhân phổ biến thường do GPG Key cũ đã hết hạn, bị thay đổi hoặc repository sử dụng khóa xác thực mới. Nếu không xử lý kịp thời, việc cập nhật hệ thống và cài đặt phần mềm sẽ bị gián đoạn, ảnh hưởng trực tiếp đến hoạt động của máy chủ.
Trong bài viết này, Zhost sẽ hướng dẫn bạn cách thay đổi và cập nhật GPG Key cho AlmaLinux 8 một cách an toàn, chính xác và đúng chuẩn, giúp hệ thống hoạt động ổn định, đảm bảo tính toàn vẹn và bảo mật khi sử dụng các kho phần mềm.
Importing GPG key 0xC21AD6EA: Userid : "AlmaLinux <[email protected]>" 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
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
Hướng dẫn thực hiện
- Để 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:
rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux
- Sau đó chạy lệnh sau để kiểm tra:
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.
- Lúc này, bạn có thể Update OS và cài đặt các gói như bình thường.
Kết luận
Việc thay đổi hoặc cập nhật GPG Key trên AlmaLinux 8 là thao tác cần thiết để đảm bảo hệ thống có thể tiếp tục cài đặt và cập nhật phần mềm một cách an toàn. Thực hiện đúng các bước sẽ giúp bạn tránh được lỗi xác thực, duy trì tính bảo mật và sự ổn định cho máy chủ. Trong quá trình vận hành VPS hoặc Cloud Server, bạn nên thường xuyên kiểm tra tình trạng repository và GPG Key để kịp thời xử lý khi có thay đổi từ nhà cung cấp. Điều này đặc biệt quan trọng với các hệ thống production, máy chủ web, mail server hoặc dịch vụ doanh nghiệp. Chúc các bạn thành công!
