如何在 CentOS 7 上升级 rpm?

如何在 CentOS 7 上升级 rpm?

在我的 CentOS 7 中,yum 出现故障。我想重新安装它。但是,我的“rpm”版本太低,无法重新安装yum?如何在 CentOS 7 上升级 rpm?谢谢。注意:我以 root 身份登录。而所有这些都是在集群上完成的,而不是个人计算机上。这是我所做的以及我收到的消息。

rpm -U rpm-apidocs-4.11.3-40.el7.noarch
package rpm-apidocs-4.11.3-40.el7.noarch is already installed # not surprised because I have upgraded it

rpm -Uvh yum-3.4.3-163.el7.centos.noarch.rpm
error: Failed dependencies:
    rpm >= 0:4.11.3-22 is needed by yum-3.4.3-163.el7.centos.noarch

rpm --prefix="/usr/bin/" -U rpm-apidocs-4.11.3-40.el7.noarch.rpm 
error: package rpm-apidocs is not relocatable

我是否可以将所有依赖项一起安装,就像一个命令可以安装所有依赖项和包一样?我真诚地感谢您的宝贵时间。 rpm -Uvh yum-3.4.3-163.el7.centos.noarch.rpm 错误:依赖项失败:yum-3.4.3-163.el7.centos.noarch 需要 rpm >= 0:4.11.3-22


rpm -U rpm-4.11.3-40.el7.x86_64.rpm 
error: Failed dependencies:
    rpm = 4.11.3-21.el7 is needed by (installed) rpm-libs-4.11.3-21.el7.x86_64
    rpm = 4.11.3-21.el7 is needed by (installed) rpm-python-4.11.3-21.el7.x86_64
    rpm = 4.11.3-21.el7 is needed by (installed) rpm-devel-4.11.3-21.el7.x86_64
    rpm = 4.11.3-21.el7 is needed by (installed) rpm-build-4.11.3-21.el7.x86_64


rpm -U rpm-libs-4.11.3-40.el7.x86_64.rpm 
error: Failed dependencies:
    rpm = 4.11.3-40.el7 is needed by rpm-libs-4.11.3-40.el7.x86_64
    rpm-libs(x86-64) = 4.11.3-21.el7 is needed by (installed) rpm-build-libs-4.11.3-21.el7.x86_64
    rpm-libs(x86-64) = 4.11.3-21.el7 is needed by (installed) rpm-devel-4.11.3-21.el7.x86_64

=================================================== ================================

rpm -qR rpm-4.11
package rpm-4.11 is not installed

rpm -i http://mirror.alpha-labs.net/centos/7/os/x86_64/Packages/rpm-4.11.3-40.el7.x86_64.rpm
    file /bin/rpm from install of rpm-4.11.3-40.el7.x86_64 conflicts with file from package rpm-4.11.3-21.el7.x86_64
    file /usr/bin/rpm2cpio from install of rpm-4.11.3-40.el7.x86_64 conflicts with file from package rpm-4.11.3-21.el7.x86_64
    file /usr/bin/rpmdb from install of rpm-4.11.3-40.el7.x86_64 conflicts with file from package rpm-4.11.3-21.el7.x86_64
    file /usr/bin/rpmkeys from install of rpm-4.11.3-40.el7.x86_64 conflicts with file from package rpm-4.11.3-21.el7.x86_64
    file /usr/lib/rpm/rpmpopt-4.11.3 from install of rpm-4.11.3-40.el7.x86_64 conflicts with file from package rpm-4.11.3-21.el7.x86_64
    file /usr/share/man/man8/rpm.8.gz from install of rpm-4.11.3-40.el7.x86_64 conflicts with file from package rpm-4.11.3-21.el7.x86_64


rpm -iUvh http://mirror.alpha-labs.net/centos/7/os/x86_64/Packages/rpm-4.11.3-40.el7.x86_64.rpm
Retrieving http://mirror.alpha-labs.net/centos/7/os/x86_64/Packages/rpm-4.11.3-40.el7.x86_64.rpm
error: Failed dependencies:
    rpm = 4.11.3-21.el7 is needed by (installed) rpm-libs-4.11.3-21.el7.x86_64
    rpm = 4.11.3-21.el7 is needed by (installed) rpm-python-4.11.3-21.el7.x86_64
    rpm = 4.11.3-21.el7 is needed by (installed) rpm-devel-4.11.3-21.el7.x86_64
    rpm = 4.11.3-21.el7 is needed by (installed) rpm-build-4.11.3-21.el7.x86_64

答案1

从 CentOS 7下载最新版本rpm并更新:

rpm -U rpm-version......

然后下载yum包并以同样的方式更新

您需要更新的软件包rpm不是rpm-apidocs.这是该包的一个镜像: http://mirror.alpha-labs.net/centos/7/os/x86_64/Packages/rpm-4.11.3-40.el7.x86_64.rpm

要获取依赖项列表,您可以使用命令:

rpm -qR rpm-version....

并以这种方式安装它们:

rpm -i pkg1 pkg2 pkg3

你不需要下载它们,rpm了解http协议就可以这样安装:

rpm -i http://mirror.alpha-labs.net/centos/7/os/x86_64/Packages/rpm-4.11.3-40.el7.x86_64.rpm

更新将如下所示:

rpm -Uvh http://mirror.alpha-labs.net/centos/7/os/x86_64/Packages/rpm-4.11.3-40.el7.x86_64.rpm \
http://mirror.alpha-labs.net/centos/7/os/x86_64/Packages/rpm-libs-4.11.3-21.el7.x86_64.rpm \
http://mirror.alpha-labs.net/centos/7/os/x86_64/Packages/rpm-python-4.11.3-21.el7.x86_64.rpm \
http://mirror.alpha-labs.net/centos/7/os/x86_64/Packages/rpm-devel-4.11.3-21.el7.x86_64.rpm \
http://mirror.alpha-labs.net/centos/7/os/x86_64/Packages/rpm-build-4.11.3-21.el7.x86_64.rpm

相关内容