从不同的存储库替换 CentOS / RedHat 包

从不同的存储库替换 CentOS / RedHat 包

我继承了一台 CentOS 服务器,其中从 epel 存储库安装了 nodejs。但是,我需要它的特定版本,因此我安装了 nodejs 存储库,但我无法从新存储库更新它,因为它告诉我以下内容:

Loaded plugins: fastestmirror
nodesource                                                                                                                                                                                    | 2.5 kB  00:00:00     
nodesource/x86_64/primary_db                                                                                                                                                                  |  38 kB  00:00:00     
Loading mirror speeds from cached hostfile
 * base: ftp.freepark.org
 * epel: mirror.imt-systems.com
 * extras: ftp.freepark.org
 * remi: mirror.23media.de
 * remi-php56: mirror.23media.de
 * remi-safe: mirror.23media.de
 * updates: ftp.freepark.org
Resolving Dependencies
--> Running transaction check
---> Package npm.x86_64 1:3.10.10-1.6.9.4.2.el7 will be updated
---> Package npm.x86_64 1:3.10.10-1.6.10.1.2.el7 will be an update
--> Processing Dependency: nodejs = 1:6.10.1-2.el7 for package: 1:npm-3.10.10-1.6.10.1.2.el7.x86_64
--> Running transaction check
---> Package nodejs.x86_64 1:6.9.4-2.el7 will be updated
--> Processing Dependency: nodejs(x86-64) = 1:6.9.4-2.el7 for package: 1:nodejs-devel-6.9.4-2.el7.x86_64
---> Package nodejs.x86_64 1:6.10.1-2.el7 will be an update
--> Running transaction check
---> Package nodejs-devel.x86_64 1:6.9.4-2.el7 will be updated
---> Package nodejs-devel.x86_64 2:6.10.2-2nodesource.el7.centos will be an update
--> Processing Dependency: nodejs(x86-64) = 2:6.10.2-2nodesource.el7.centos for package: 2:nodejs-devel-6.10.2-2nodesource.el7.centos.x86_64
epel/x86_64/filelists_db                                                                                                                                                                      | 7.7 MB  00:00:00     
--> Running transaction check
---> Package nodejs.x86_64 1:6.9.4-2.el7 will be updated
---> Package nodejs.x86_64 1:6.9.4-2.el7 will be updated
---> Package nodejs.x86_64 1:6.10.1-2.el7 will be an update
--> Processing Dependency: nodejs = 1:6.10.1-2.el7 for package: 1:npm-3.10.10-1.6.10.1.2.el7.x86_64
---> Package nodejs.x86_64 2:6.10.2-2nodesource.el7.centos will be an update
--> Finished Dependency Resolution
Error: Package: 1:npm-3.10.10-1.6.10.1.2.el7.x86_64 (epel)
           Requires: nodejs = 1:6.10.1-2.el7
           Removing: 1:nodejs-6.9.4-2.el7.x86_64 (@epel)
               nodejs = 1:6.9.4-2.el7
           Updated By: 2:nodejs-6.10.2-2nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 2:6.10.2-2nodesource.el7.centos
           Available: nodejs-6.0.0-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 6.0.0-1nodesource.el7.centos
           Available: nodejs-6.1.0-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 6.1.0-1nodesource.el7.centos
           Available: nodejs-6.2.0-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 6.2.0-1nodesource.el7.centos
           Available: nodejs-6.2.1-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 6.2.1-1nodesource.el7.centos
           Available: nodejs-6.2.2-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 6.2.2-1nodesource.el7.centos
           Available: 1:nodejs-6.3.0-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 1:6.3.0-1nodesource.el7.centos
           Available: 1:nodejs-6.3.1-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 1:6.3.1-1nodesource.el7.centos
           Available: 1:nodejs-6.4.0-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 1:6.4.0-1nodesource.el7.centos
           Available: 1:nodejs-6.6.0-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 1:6.6.0-1nodesource.el7.centos
           Available: 1:nodejs-6.7.0-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 1:6.7.0-1nodesource.el7.centos
           Available: 1:nodejs-6.10.1-2.el7.x86_64 (epel)
               nodejs = 1:6.10.1-2.el7
           Available: 2:nodejs-6.8.0-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 2:6.8.0-1nodesource.el7.centos
           Available: 2:nodejs-6.8.1-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 2:6.8.1-1nodesource.el7.centos
           Available: 2:nodejs-6.9.0-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 2:6.9.0-1nodesource.el7.centos
           Available: 2:nodejs-6.9.1-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 2:6.9.1-1nodesource.el7.centos
           Available: 2:nodejs-6.9.2-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 2:6.9.2-1nodesource.el7.centos
           Available: 2:nodejs-6.9.3-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 2:6.9.3-1nodesource.el7.centos
           Available: 2:nodejs-6.9.4-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 2:6.9.4-1nodesource.el7.centos
           Available: 2:nodejs-6.9.5-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 2:6.9.5-1nodesource.el7.centos
           Available: 2:nodejs-6.10.0-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 2:6.10.0-1nodesource.el7.centos
           Available: 2:nodejs-6.10.1-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 2:6.10.1-1nodesource.el7.centos
           Available: 2:nodejs-6.10.2-1nodesource.el7.centos.x86_64 (nodesource)
               nodejs = 2:6.10.2-1nodesource.el7.centos
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

您将如何解决这个问题?

答案1

上游存储库不完整。它列出了依赖关系计算不同部分的不兼容版本。这是一种自我造成的状况,称为依赖地狱。当您混合使用不稳定的第三方存储库时,就会发生这种情况。另外,请真正理解,安装第三方内容会让您陷入支持问题、安全问题和软件包消失问题的巨大地狱。请认真考虑本周发布的内容是否值得您花费大量时间永久使用,并考虑您是否真的想改用全新的 c7 主机。

答案2

查看/etc/yum.repos.d/目录 ( ls /etc/yum.repos.d/) 你可能会看到类似的内容nodesource-el7.repo。运行以下命令:

sudo rm /etc/yum.repos.d/nodesource-el7.repo
yum clean all 

现在yum repolist命令不应该出现nodesource-el7.repo在显示的列表中。

安装 nodejs 和 npm

curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
sudo yum install -y nodejs

(上面的 8.x,可以是 9.x 或 10.x,或者您想要的任何版本的节点)

检查一下我们的安装

node -v
npm -v

(希望)胜利!

相关内容