当前位置:首页 > 技术分享 > 正文内容

在CentOS 5.x 6.x里使用yum源 换阿里云国内源换vault.centos.org源

admin4年前 (2021-04-14)技术分享3900

阿里云CentOS 5 的系统,无法用yum来安装应用软件。 

 

原因:CentOS 5 在2017-03-31日已经结束支持,不再提供维护更新,所以包括阿里云镜像站的文件可能都是过时或已经有部分文件缺失。 

 2020年11月30日CentOS 6 EOL。按照社区规则,CentOS 6的源地址http://mirror.centos.org/centos-6/内容已移除,目前第三方的镜像站中均已移除CentOS 6的源。阿里云的源http://mirrors.cloud.aliyuncs.comhttp://mirrors.aliyun.com也无法同步到CentOS 6的源。当您在阿里云上继续使用默认配置的CentOS 6的源会发生报错。

环境:CentOS 5. X 6.X


方法

1.只保留/etc/yum.repos.d/CentOS-Base.repo 其它文件 要么删除要么改后缀

2.编辑文件 /etc/yum.repos.d/CentOS-Base.repo ,将其中的 mirrors.aliyun.com/centos/$releasever 替换成相应历史源站地址和版本号,

如 vault.centos.org/5.11


[base]
name=CentOS-$releasever - Base
failovermethod=priority
baseurl=http://vault.centos.org/5.11/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5
http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name=CentOS-$releasever - Updates
failovermethod=priority
baseurl=http://vault.centos.org/5.11/updates/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5
http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
failovermethod=priority
baseurl=http://vault.centos.org/5.11/extras/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5
http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
failovermethod=priority
baseurl=http://vault.centos.org/5.11/centosplus/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5
http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
failovermethod=priority
baseurl=http://vault.centos.org/5.11/contrib/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5
[base]
name=CentOS-$releasever - Base
failovermethod=priority
baseurl=http://vault.centos.org/6.5/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
failovermethod=priority
baseurl=http://vault.centos.org/6.5/updates/$basearch/
		http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
failovermethod=priority
baseurl=http://vault.centos.org/6.5/extras/$basearch/
		http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
failovermethod=priority
baseurl=http://vault.centos.org/6.5/centosplus/$basearch/
		http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
failovermethod=priority
baseurl=http://vault.centos.org/6.5/contrib/$basearch/
		http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-6

3. 确认在 /etc/yum.repos.d/目录没有除了CentOS-Base.repo之外其他以repo结尾的文件,如果有的话需要删除,然后执行 yum clean all && yum makecache 更新和启用新的yum源。

操作步骤



  1. 登录CentOS 6系统的ECS实例。

    具体操作,请参见连接方式概述
  2. 运行以下命令编辑CentOS-Base.repo 文件。

    vim /etc/yum.repos.d/CentOS-Base.repo
  3. i进入编辑模式,修改以下内容切换源。

    请根据实例不同的网络类型进行修改,具体内容如下:

    编辑完成后,按Esc键,并输入:wq保存退出文件。

    • 专有网络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
  4. 运行以下命令编辑epel.repo 文件。

    vim /etc/yum.repos.d/epel.repo
  5. i进入编辑模式,修改以下内容切换源。

    请根据实例不同的网络类型进行修改,具体内容如下:

    编辑完成后,按Esc键,并输入:wq保存退出文件。

    • 专有网络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-
    • 经典网络类型实例

      [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

扫描二维码推送至手机访问。

版权声明:本文由小刚刚技术博客发布,如需转载请注明出处。

本文链接:https://blog.bitefu.net/post/159.html

分享给朋友:

相关文章

百度云,天翼云盘解析网页地址 收集分享

百度云解析http://p.106666.xyz/https://pan.kdbaidu.com/https://pan.kdpd.me/https://yun.kdbaidu.com/http://blog.xxatf.top/https...

input search更改默认删除按钮的样式

改input输入框search属性下输入文字之后会在输入框最后出现一个默认样式的X不过这个样式不太好看想自定义怎么办呢方法一input[type="search"]::-webkit-search-cancel-butt...

超高性比的斐讯盒子T1,刷第三方YYF固件机教程超级详细版

超高性比的斐讯盒子T1,刷第三方YYF固件机教程超级详细版

家里面买了斐讯盒子T1,必不可少的就是刷机,刷机一直爽,一直刷机一直爽,这样的快乐一般人体会不到。原来斐讯盒子N1,T1,还有斐讯K2P路由器也变成了性价比超高的东东,而且众多大神也带来了超多可玩性非常高的固件和破解。楼主今天扒到了相关超高...

centos 配置Let's Encrypt 泛域名https证书

centos 配置Let's Encrypt 泛域名https证书

前言2018年1月份Letsencrypt可以申请泛域名证书,这让我们部署多域名、多站点https省了很多功夫,终于可以不用维护多个域名的https证书。笔者以acme.sh为例,手把手教你配置https证书~本教程适用于centos 6....

PHP AES加解密 (ECB模式/sha1prng算法/PKCS5Padding和PKCS7Padding补码) ECB 模式不需求设置 iv

php7+ 版本/**  * [AesSecurity aes加密,支持PHP7+]  * 算法模式:ECB  * 密钥长度:128  * 补...

php Aes 加密模式ECB填充pkcs5padding base64

最近做支付项目用到了aes加密不过试了好多办法总是和官方给出的结果不一样,找了很久终于找到了测试结果同 http://tool.chacuo.net/cryptaes/ <?php /**  * [Aes&nb...

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。