我有一台阿里云的Linux服务器,安装的是CenTos6.9,刚才在使用yum upgrade和yum update进行更新的时候,返回以下错误信息,更新不能够进行。
Downloading Packages: http://mirrors.cloud.aliyuncs.com/centos/6/updates/x86_64/Packages/kernel-2.6.32-754.35.1.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" Trying other mirror. http://mirrors.cloud.aliyuncs.com/centos/6/updates/x86_64/Packages/kernel-devel-2.6.32-754.35.1.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" Trying other mirror. http://mirrors.cloud.aliyuncs.com/centos/6/updates/x86_64/Packages/kernel-firmware-2.6.32-754.35.1.el6.noarch.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" Trying other mirror. http://mirrors.cloud.aliyuncs.com/centos/6/updates/x86_64/Packages/kernel-headers-2.6.32-754.35.1.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" Trying other mirror. http://mirrors.cloud.aliyuncs.com/centos/6/updates/x86_64/Packages/libX11-1.6.4-4.el6_10.x86_64.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" Trying other mirror. http://mirrors.cloud.aliyuncs.com/centos/6/updates/x86_64/Packages/libX11-common-1.6.4-4.el6_10.noarch.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" Trying other mirror. http://mirrors.cloud.aliyuncs.com/centos/6/updates/x86_64/Packages/libX11-devel-1.6.4-4.el6_10.x86_64.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" Trying other mirror. http://mirrors.cloud.aliyuncs.com/centos/6/updates/x86_64/Packages/tzdata-2020d-1.el6.noarch.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" Trying other mirror. Error Downloading Packages: kernel-devel-2.6.32-754.35.1.el6.x86_64: failure: Packages/kernel-devel-2.6.32-754.35.1.el6.x86_64.rpm from updates: [Errno 256] No more mirrors to try. tzdata-2020d-1.el6.noarch: failure: Packages/tzdata-2020d-1.el6.noarch.rpm from updates: [Errno 256] No more mirrors to try. kernel-2.6.32-754.35.1.el6.x86_64: failure: Packages/kernel-2.6.32-754.35.1.el6.x86_64.rpm from updates: [Errno 256] No more mirrors to try. libX11-devel-1.6.4-4.el6_10.x86_64: failure: Packages/libX11-devel-1.6.4-4.el6_10.x86_64.rpm from updates: [Errno 256] No more mirrors to try. libX11-common-1.6.4-4.el6_10.noarch: failure: Packages/libX11-common-1.6.4-4.el6_10.noarch.rpm from updates: [Errno 256] No more mirrors to try. libX11-1.6.4-4.el6_10.x86_64: failure: Packages/libX11-1.6.4-4.el6_10.x86_64.rpm from updates: [Errno 256] No more mirrors to try. kernel-headers-2.6.32-754.35.1.el6.x86_64: failure: Packages/kernel-headers-2.6.32-754.35.1.el6.x86_64.rpm from updates: [Errno 256] No more mirrors to try. kernel-firmware-2.6.32-754.35.1.el6.noarch: failure: Packages/kernel-firmware-2.6.32-754.35.1.el6.noarch.rpm from updates: [Errno 256] No more mirrors to try.
在阿里云的帮助文档里得知,CentOS 6操作系统版本结束了生命周期(EOL),Linux社区已不再维护该操作系统版本。建议您升级操作系统至CentOS 7及以上,如果您的业务过渡期仍需要使用CentOS 6系统中的一些安装包,请根据下文切换CentOS 6的源。
2020年11月30日CentOS 6 EOL。按照社区规则,CentOS 6的源地址http://mirror.centos.org/centos-6/内容已移除,目前第三方的镜像站中均已移除CentOS 6的源。阿里云的源http://mirrors.cloud.aliyuncs.com和http://mirrors.aliyun.com也无法同步到CentOS 6的源。当您在阿里云上继续使用默认配置的CentOS 6的源会发生报错。报错示例如下图所示:centos 6 error
您可以通过下文的操作步骤,在CentOS 6操作系统的ECS实例中将源配置按照网络环境不同进行切换。
yum源
专有网络VPC类型实例需切换为http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/源。
经典网络类型实例需切换为http://mirrors.aliyuncs.com/centos-vault/6.10/源。
epel源
专有网络VPC类型实例需切换为http://mirrors.cloud.aliyuncs.com/epel-archive/6/源。
经典网络类型实例需切换为http://mirrors.aliyuncs.com/epel-archive/6/源。
运行以下命令编辑CentOS-Base.repo 文件。
vim /etc/yum.repos.d/CentOS-Base.repo
按i进入编辑模式,修改以下内容切换源。
请根据实例不同的网络类型进行修改,具体内容如下:
专有网络VPC类型实例
[base] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6 [updates] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6 [extras] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6
经典网络类型实例
[base] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.aliyuncs.com/centos-vault/6.10/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6 [updates] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.aliyuncs.com/centos-vault/6.10/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyuncs.comm/centos-vault/RPM-GPG-KEY-CentOS-6 [extras] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.aliyuncs.com/centos-vault/6.10/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6
编辑完成后,按Esc键,并输入:wq保存退出文件。
运行以下命令编辑epel.repo 文件。
vim /etc/yum.repos.d/epel.repo
按i进入编辑模式,修改以下内容切换源。
请根据实例不同的网络类型进行修改,具体内容如下:
专有网络VPC类型实例
[epel] name=Extra Packages for Enterprise Linux 6 - $basearch enabled=1 failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/epel-archive/6/$basearch gpgcheck=0 gpgkey=http://mirrors.cloud.aliyuncs.com/epel-archive/RPM-GPG-KEY-EPEL-6
经典网络类型实例
[epel] name=Extra Packages for Enterprise Linux 6 - $basearch enabled=1 failovermethod=priority baseurl=http://mirrors.aliyuncs.com/epel-archive/6/$basearch gpgcheck=0 gpgkey=http://mirrors.aliyuncs.com/epel-archive/RPM-GPG-KEY-EPEL-6
编辑完成后,按Esc键,并输入:wq保存退出文件。
切换完成后,您可以使用yum upgrade或yum update命令安装需要的软件包。
sicnature ---------------------------------------------------------------------
I P 地 址: 18.117.158.10
区 域 位 置: 美国马萨诸塞
系 统 信 息:
Original content, please indicate the source:
同福客栈论坛 | 蟒蛇科普 | 海南乡情论坛 | JiaYu Blog
sicnature ---------------------------------------------------------------------
2条评论
1.进入yum源配置目录
cd /etc/yum.repos.d
2. 备份原来的yum源,便于恢复,改啥都得留个备份,万一玩儿了还能恢复
mv CentOS-Base.repo CentOS-Base.repo.bk
3. 下载新的CentOS-Base.repo 到/etc/yum.repos.d/
//更新为阿里云的源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
//更新为163的源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
//更新为搜狐的源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
4. 运行yum makecache生成缓存
yum clean all
yum makecache
可以使用vault.centos.org作为更新源
CentOS官方:http://vault.centos.org/
阿里云镜像:http://mirrors.aliyun.com/centos-vault/
1、关闭fastestmirror
vi /etc/yum/pluginconf.d/fastestmirror.conf
enable=0
2、将原来的源备份处理
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
3、更换源
#替换为官方Vault源:wget -O /etc/yum.repos.d/CentOS-Base.repo https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Centos-6-Vault-Official.repo
#替换为阿里云Vault镜像:wget -O /etc/yum.repos.d/CentOS-Base.repo https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Centos-6-Vault-Aliyun.repo
https://www.centos.org/download/
http://archive.kernel.org/centos-vault/
rsync://archive.kernel.org::centos-vault/
http://linuxsoft.cern.ch/centos-vault/
rsync://linuxsoft.cern.ch/centos-vault/
http://mirror.nsc.liu.se/centos-store/
rsync://mirror.nsc.liu.se::centos-store/