简体   繁体   中英

How to install rpm and dependencies on RHEL?

I'm trying to install python3-gnupg on my RHEL EC2 server.

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.

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.

Command for dnf:

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

Command for 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)

You may still have a problem with python.

Indeed, it requires a fixed version of python (the 3.8 version) and dnf/yum may refuse to install one.

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)

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. Either with dnf or 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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