yum中apt-key的等效工具是什么?AWS AMI部署无头Selenium爬虫适配问题
apt-key for YUM on AWS AMI Hey there! Since you're working with AWS AMI (which uses YUM/DNF package management instead of Ubuntu's APT), the equivalent tool for handling GPG keys is built right into rpm and YUM itself—no separate apt-key-like standalone tool is needed. Here's how to adapt that initial tutorial step for your system:
1. Import the GPG key directly with rpm
The apt-key add command in Ubuntu adds a key to the system's trusted keyring. For YUM-based systems like AWS AMI, you can use rpm --import to do the exact same job. Modify the tutorial's first command like this:
wget -q -O - "https://dl-ssl.google.com/linux/linux_signing_key.pub" | rpm --import -
This pipes the downloaded Google signing key directly into rpm, which adds it to the system's trusted GPG key database.
2. Alternative: Save the key to YUM's default key directory
YUM automatically looks for trusted keys in /etc/pki/rpm-gpg/. You can download the key to this directory instead, then reference it explicitly in your repo configuration:
wget -q -O /etc/pki/rpm-gpg/RPM-GPG-KEY-google "https://dl-ssl.google.com/linux/linux_signing_key.pub"
When you set up the Google Chrome repo (next step in your workflow), add this line to your .repo file to link to the key:
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-google
Quick note for Amazon Linux 2023 users
If you're on the newer Amazon Linux 2023 release, you'll use dnf instead of yum, but the rpm --import command works exactly the same way. You can also use dnf config-manager to manage repos, but the key handling process stays identical.
Once you've imported the key, you can proceed to create the Google Chrome repo file (in /etc/yum.repos.d/) and install Chrome via yum install google-chrome-stable—just adjust the syntax from the Ubuntu tutorial to fit YUM's workflow.
内容的提问来源于stack exchange,提问作者sometimesiwritecode

