Centos6 源

背景

centos6操作系统版本已经结束了生命周期(EOL),linux社区已经不再维护该操作系统的版本建议升级操作系统至centos7如果生产中业务过度期仍需要使用centos6系统中的一些安装包,请按照下文切换centos6的yum源2020年11月30日CentOS6EOL。按照社区规则CentOS6的源地址http://mirror.centos.org/centos-6/内容已移除目前第三方的镜像站中均已移除CentOS6的源。阿里云的源http://mirrors.cloud.aliyuncs.com和http://mirrors.aliyun.com也无法同步到CentOS6的源。当您在阿里云上继续使用默认配置的CentOS6的源会发生报错。报错示例如下图所示:
在这里插入图片描述

解决办法:

直接在linux命令行执行以下代码即可
cat >> /etc/yum.repos.d/CentOS-aliyun-lhr.repo <<“EOF” [base] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/ b a s e a r c h / g p g c h e c k = 1 g p g k e y = h t t p : / / m i r r o r s . a l i y u n . c o m / c e n t o s − v a u l t / R P M − G P G − K E Y − C e n t O S − 6 [ u p d a t e s ] n a m e = C e n t O S − 6.10 e n a b l e d = 1 f a i l o v e r m e t h o d = p r i o r i t y b a s e u r l = h t t p : / / m i r r o r s . a l i y u n . c o m / c e n t o s − v a u l t / 6.10 / u p d a t e s / basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 [updates] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/ basearch/gpgcheck=1gpgkey=http://mirrors.aliyun.com/centosvault/RPMGPGKEYCentOS6[updates]name=CentOS6.10enabled=1failovermethod=prioritybaseurl=http://mirrors.aliyun.com/centosvault/6.10/updates/basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.comm/centos-vault/RPM-GPG-KEY-CentOS-6 [extras] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 [epel] name=Extra Packages for Enterprise Linux 6 - b a s e a r c h e n a b l e d = 1 f a i l o v e r m e t h o d = p r i o r i t y b a s e u r l = h t t p : / / m i r r o r s . a l i y u n . c o m / e p e l − a r c h i v e / 6 / basearch enabled=1 failovermethod=priority baseurl=http://mirrors.aliyun.com/epel-archive/6/ basearchenabled=1failovermethod=prioritybaseurl=http://mirrors.aliyun.com/epelarchive/6/basearch gpgcheck=0 gpgkey=http://mirrors.aliyun.com/epel-archive/RPM-GPG-KEY-EPEL-6 EOF cat >> /etc/yum.repos.d/CentOS-neusoft-lhr.repo <<“EOF” [base] name=CentOS-6-Base baseurl=http://mirrors.neusoft.edu.cn/centos/6/os/ b a s e a r c h / g p g c h e c k = 1 g p g k e y = h t t p : / / m i r r o r . c e n t o s . o r g / c e n t o s / R P M − G P G − K E Y − C e n t O S − 6 [ u p d a t e s ] n a m e = C e n t O S − 6 − U p d a t e s b a s e u r l = h t t p : / / m i r r o r s . n e u s o f t . e d u . c n / c e n t o s / 6 / u p d a t e s / basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 [updates] name=CentOS-6-Updates baseurl=http://mirrors.neusoft.edu.cn/centos/6/updates/ basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPMGPGKEYCentOS6[updates]name=CentOS6Updatesbaseurl=http://mirrors.neusoft.edu.cn/centos/6/updates/basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 [extras] name=CentOS-6-Extras baseurl=http://mirrors.neusoft.edu.cn/centos/6/extras/ b a s e a r c h / g p g c h e c k = 1 g p g k e y = h t t p : / / m i r r o r . c e n t o s . o r g / c e n t o s / R P M − G P G − K E Y − C e n t O S − 6 [ c e n t o s p l u s ] n a m e = C e n t O S − 6 − P l u s b a s e u r l = h t t p : / / m i r r o r s . n e u s o f t . e d u . c n / c e n t o s / 6 / c e n t o s p l u s / basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 [centosplus] name=CentOS-6-Plus baseurl=http://mirrors.neusoft.edu.cn/centos/6/centosplus/ basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPMGPGKEYCentOS6[centosplus]name=CentOS6Plusbaseurl=http://mirrors.neusoft.edu.cn/centos/6/centosplus/basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 [contrib] name=CentOS-6-Contrib baseurl=http://mirrors.neusoft.edu.cn/centos/6/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 [epel] name=Extra Packages for Enterprise Linux 6 - b a s e a r c h e n a b l e d = 1 f a i l o v e r m e t h o d = p r i o r i t y b a s e u r l = h t t p : / / m i r r o r s . n e u s o f t . e d u . c n / e p e l / 6 / basearch enabled=1 failovermethod=priority baseurl=http://mirrors.neusoft.edu.cn/epel/6/ basearchenabled=1failovermethod=prioritybaseurl=http://mirrors.neusoft.edu.cn/epel/6/basearch gpgcheck=0 gpgkey=http://mirrors.neusoft.edu.cn/epel/RPM-GPG-KEY-EPEL-6 EOF
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
### 回答1: 首先,您需要打开终端,然后输入以下命令来备份原来的: sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak 然后,使用以下命令下载阿里云的 CentOS 6 的: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo 最后,使用以下命令清除 yum 缓存并生成新的缓存: sudo yum clean all sudo yum makecache 这样就可以使用阿里云的 CentOS 6 了。 注意:上面的命令假设您正在使用阿里云的。如果您想使用其他,请替换掉上述命令中的 URL。 ### 回答2: CentOS 6是一种基于Linux的操作系统,阿里是一种软件,用于下载和安装软件包。要更换CentOS 6的阿里,您可以按照以下步骤进行操作: 1. 使用root用户登录到CentOS 6系统。 2. 打开终端窗口,输入以下命令以备份旧的软件列表文件: ``` cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup ``` 3. 使用文本编辑器(例如vi或nano)打开软件列表文件: ``` vi /etc/yum.repos.d/CentOS-Base.repo ``` 4. 在打开的文件中,将所有以`baseurl`和`mirrorlist`开头的行注释掉(在行的最前面添加#字符)。 5. 在文件的末尾添加以下内容,以使用阿里: ``` [base] name=CentOS-$releasever - Base baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-$releasever [updates] name=CentOS-$releasever - Updates baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-$releasever [extras] name=CentOS-$releasever - Extras baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-$releasever ``` 6. 保存文件并退出编辑器。 7. 清除并重建软件缓存,以使更改生效: ``` yum clean all yum makecache ``` 现在,您已成功更换CentOS 6的阿里。您可以使用yum命令安装和更新软件包时,系统将从阿里下载软件包。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

文龙的_VLOG.

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值