CentOS Linux 8在2022年12月31日来到生命周期终点(End of Life,EoL)。即CentOS Linux 8操作系统版本结束了生命周期(EOL),Linux社区已不再维护该操作系统版本。所以原来的CentOS Linux 8的yum源也都失效了!最终导致此问题的产生。
[root@VM-16-7-centos ~]# yum module list nodejs
Repository AppStream is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository epel is listed more than once in the configuration
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/nodesource-el8.repo; 配置:ID 为 "failovermethod" 的 OptionBinding 不存在
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/nodesource-el8.repo; 配置:ID 为 "failovermethod" 的 OptionBinding 不存在
CentOS Linux 8 - AppStream 69 B/s | 38 B 00:00
错误:为仓库 'appstream' 下载元数据失败 : Cannot prepare internal mirrorlist: No URLs in mirrorlist
[root@VM-16-7-centos ~]# cd /etc/yum.repos.d/
[root@VM-16-7-centos yum.repos.d]# ls -l
[root@VM-16-7-centos yum.repos.d]# mkdir bak
[root@VM-16-7-centos yum.repos.d]# mv CentOS-* bak
下载源文件命令:
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
[root@VM-16-7-centos yum.repos.d]# rm -rf *
[root@VM-16-7-centos yum.repos.d]# ls
[root@VM-16-7-centos yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
--2022-03-07 09:13:32-- https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 122.225.209.208, 122.225.209.209, 122.228.195.210, ...
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|122.225.209.208|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:2495 (2.4K) [application/octet-stream]
正在保存至: “/etc/yum.repos.d/CentOS-Base.repo”
/etc/yum.repos.d/CentOS-Base.repo 100%[============================================================================>] 2.44K --.-KB/s 用时 0.009s
2022-03-07 09:13:32 (286 KB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2495/2495])
[root@VM-16-7-centos yum.repos.d]# ls
CentOS-Base.repo
[root@VM-16-7-centos yum.repos.d]# vim CentOS-Base.repo
[root@VM-16-7-centos yum.repos.d]# yum makecache
CentOS-8.5.2111 - Base - mirrors.aliyun.com 105 kB/s | 3.9 kB 00:00
CentOS-8.5.2111 - Extras - mirrors.aliyun.com 39 kB/s | 1.5 kB 00:00
CentOS-8.5.2111 - AppStream - mirrors.aliyun.com 441 kB/s | 8.4 MB 00:19
元数据缓存已建立。
[root@VM-16-7-centos yum.repos.d]# yum yum module list nodejs
未找到命令: yum。请使用 /usr/bin/yum --help
它可能是一个YUM插件命令,尝试:"yum install 'dnf-command(yum)'"
[root@VM-16-7-centos yum.repos.d]# dnf update -y
上次元数据过期检查:0:01:10 前,执行于 2022年03月07日 星期一 09时14分09秒。
依赖关系解决。
无需任何处理。
完毕!
[root@VM-16-7-centos yum.repos.d]# sudo yum -y install curl
上次元数据过期检查:0:02:29 前,执行于 2022年03月07日 星期一 09时14分09秒。
软件包 curl-7.61.1-22.el8.x86_64 已安装。
依赖关系解决。
无需任何处理。
完毕!
[root@VM-16-7-centos yum.repos.d]# curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -
## Installing the NodeSource Node.js 14.x repo...
## Inspecting system...
+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release || rpm -q --whatprovides fedora-release
+ uname -m
## Confirming "el8-x86_64" is supported...
+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_14.x/el/8/x86_64/nodesource-release-el8-1.noarch.rpm'
## As yum will try to install Node.js from the AppStream repository
instead of the NodeSource repository, the AppStream's version of Node.js has to be disabled.
## Run `sudo yum module enable -y nodejs` to reactivate the AppStream's Node.js repository.
+ yum module disable -y nodejs
上次元数据过期检查:0:02:38 前,执行于 2022年03月07日 星期一 09时14分09秒。
依赖关系解决。
=============================================================================================================================================================
软件包 架构 版本 仓库 大小
=============================================================================================================================================================
禁用模块:
nodejs
事务概要
=============================================================================================================================================================
完毕!
## Downloading release setup RPM...
+ mktemp
+ curl -sL -o '/tmp/tmp.Da9dAubFHD' 'https://rpm.nodesource.com/pub_14.x/el/8/x86_64/nodesource-release-el8-1.noarch.rpm'
## Installing release setup RPM...
+ rpm -i --nosignature --force '/tmp/tmp.Da9dAubFHD'
## Cleaning up...
+ rm -f '/tmp/tmp.Da9dAubFHD'
## Checking for existing installations...
+ rpm -qa 'node|npm' | grep -v nodesource
## Run `sudo yum install -y nodejs` to install Node.js 14.x and npm.
## You may run dnf if yum is not available:
sudo dnf install -y nodejs
## You may also need development tools to build native addons:
sudo yum install gcc-c++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarn
[root@VM-16-7-centos yum.repos.d]# ls
CentOS-Base.repo nodesource-el8.repo
[root@VM-16-7-centos yum.repos.d]# cd /home/
[root@VM-16-7-centos home]# ls
java jd_script lighthouse myfiles mysql redis6 redis-6.0.1 redis-6.0.1.tar.gz ruoyi sshPrevent tyn zengyong zengyong_root
[root@VM-16-7-centos home]# cd jd_script/
[root@VM-16-7-centos jd_script]# ls
qiandao_jd
[root@VM-16-7-centos jd_script]# sudo yum install -y nodejs
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/nodesource-el8.repo; 配置:ID 为 "failovermethod" 的 OptionBinding 不存在
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/nodesource-el8.repo; 配置:ID 为 "failovermethod" 的 OptionBinding 不存在
Node.js Packages for Enterprise Linux 8 - x86_64 284 kB/s | 1.1 MB 00:03
上次元数据过期检查:0:00:01 前,执行于 2022年03月07日 星期一 09时17分23秒。
依赖关系解决。
=============================================================================================================================================================
软件包 架构 版本 仓库 大小
=============================================================================================================================================================
安装:
nodejs x86_64 2:14.19.0-1nodesource nodesource 33 M
事务概要
=============================================================================================================================================================
安装 1 软件包
总下载:33 M
安装大小:93 M
下载软件包:
nodejs-14.19.0-1nodesource.x86_64.rpm 8.9 MB/s | 33 MB 00:03
-------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 8.9 MB/s | 33 MB 00:03
Node.js Packages for Enterprise Linux 8 - x86_64 1.6 MB/s | 1.6 kB 00:00
导入 GPG 公钥 0x34FA74DD:
Userid: "NodeSource <gpg-rpm@nodesource.com>"
指纹: 2E55 207A 95D9 944B 0CC9 3261 5DDB E8D4 34FA 74DD
来自: /etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
导入公钥成功
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
准备中 : 1/1
运行脚本: nodejs-2:14.19.0-1nodesource.x86_64 1/1
安装 : nodejs-2:14.19.0-1nodesource.x86_64 1/1
运行脚本: nodejs-2:14.19.0-1nodesource.x86_64 1/1
验证 : nodejs-2:14.19.0-1nodesource.x86_64 1/1
已安装:
nodejs-2:14.19.0-1nodesource.x86_64
完毕!
[root@VM-16-7-centos jd_script]#
原文链接:https://blog.csdn.net/u012374381/article/details/79790969