简体   繁体   English

如何在 RHEL 上安装 rpm 和依赖项?

[英]How to install rpm and dependencies on RHEL?

I'm trying to install python3-gnupg on my RHEL EC2 server.我正在尝试在我的 RHEL EC2 服务器上安装python3-gnupg

I used the command我使用了命令

wget https://download.fedoraproject.org/../python-gnupg-0.4.6-1.fc32.src.rpm
sudo rpm -i file.rpm

Get the error获取错误

error: Failed dependencies:
    python(abi) = 3.8 is needed by python3-gnupg-0.4.6-1.fc32.noarch
    rpmlib(PayloadIsZstd) <= 5.4.18-1 is needed by python3-gnupg-0.4.6-1.fc32.noarch

How do I download & install all dependencies at once?如何一次下载和安装所有依赖项?

You may want to use dnf or yum (if dnf is not available for some reason) to install your package instead of the rpm command.您可能想要使用 dnf 或 yum(如果 dnf 由于某种原因不可用)来安装 package 而不是 rpm 命令。

Why?为什么? Because it will actually download dependencies.因为它实际上会下载依赖项。 The rpm command does not comes with a 'remote repository' like yum or dnf, thus its incapacity to download missing dependencies. rpm 命令没有像 yum 或 dnf 这样的“远程存储库”,因此它无法下载缺少的依赖项。

Command for dnf: dnf 命令:

sudo dnf install https://download.fedoraproject.org/../python-gnupg-0.4.6-1.fc32.src.rpm

Command for yum: yum 命令:

sudo yum install https://download.fedoraproject.org/../python-gnupg-0.4.6-1.fc32.src.rpm

(you can replace the URL by the path to your RPM file and you'll want to replace the URL by the correct one) (您可以将 URL 替换为 RPM 文件的路径,并且您需要将 URL 替换为正确的路径)

You may still have a problem with python. python 可能仍有问题。

Indeed, it requires a fixed version of python (the 3.8 version) and dnf/yum may refuse to install one.实际上,它需要一个固定版本的 python(3.8 版本),而 dnf/yum 可能会拒绝安装一个。

You have two ways to fix this.您有两种方法可以解决此问题。

The first way第一种方式

Install the python3-gnupg package directly from the RHEL repo (if available, I'm not quite sure) to directly install the correct dependencies (and the version corresponding to your distro that received the RHEL tests blessing)直接从 RHEL repo 安装 python3-gnupg package (如果可用,我不太确定)直接安装正确的依赖项(以及与您的发行版相对应的版本,获得 RHEL 测试祝福)

So you may try所以你可以试试

sudo dnf install python3-gnupg

Or或者

sudo yum install python3-gnupg

The second way第二种方式

Try to install the corresponding version of python.尝试安装对应版本的python。 Either with dnf or yum.使用 dnf 或 yum。

sudo dnf install python3.8

Or或者

sudo yum install python3.8

What I would recommend我会推荐什么

IMHO, the first solution is better because you'll actually get the official RHEL version of the python3-gnupg , which has been build for your distro AND tested accordingly.恕我直言,第一个解决方案更好,因为您实际上会获得官方RHEL 版本的python3-gnupg ,该版本已为您的发行版构建并进行了相应的测试。 But it may not be available.但它可能不可用。 I actually tested those commands on my Fedora 33, because it uses the same tools as RHEL, but its dnf/yum repositories are actually different.我实际上在我的 Fedora 33 上测试了这些命令,因为它使用与 RHEL 相同的工具,但它的 dnf/yum 存储库实际上是不同的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM