阿里镜像配置 /etc/yum.repos.d/ Centos7

Posted 水月情缘雪飞飞

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了阿里镜像配置 /etc/yum.repos.d/ Centos7相关的知识,希望对你有一定的参考价值。

<?php

阿里镜像配置 /etc/yum.repos.d/ Centos7
===============================================


一:简介

    1:阿里云镜像地址:https://developer.aliyun.com/mirror/

    2:阿里云centos镜像:https://developer.aliyun.com/mirror/centos

    3:文档说明:
        如何访问
        用户             访问域名                     协议
        互联网用户        mirrors.aliyun.com          http,https
        ECS VPC 用户     mirrors.cloud.aliyuncs.com  http
        ECS 经典网络用户  mirrors.aliyuncs.com        http

    4:配置目录地址: http://mirrors.aliyun.com/repo/



二:下载新的 CentOS-Base.repo 和 epel.repo

    1:备份原有的repo文件:

        ~]# cd /etc/yum.repos.d/

        # 删除原有repo文件,不建议直接删除,最好备份一下
        ~]# rm -rf *


    2:Centos-7.repo

        文件地址: http://mirrors.aliyun.com/repo/Centos-7.repo

        ~]# wget http://mirrors.aliyun.com/repo/Centos-7.repo


    3:epel-7.repo # 注意千万不要下载 epel.repo(内容默认是epel-6.repo)

        文件地址:http://mirrors.aliyun.com/repo/epel-7.repo

        ~]# wget http://mirrors.aliyun.com/repo/epel-7.repo

    4:重新设置缓存

        ~]# yum clean all && yum makecache




三:文件内容

    1:Centos-7.repo 文件内容



# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7





    2:epel-7.repo 文件内容


[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://mirrors.aliyun.com/epel/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
 
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
baseurl=http://mirrors.aliyun.com/epel/7/$basearch/debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=0
 
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=http://mirrors.aliyun.com/epel/7/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=0


以上是关于阿里镜像配置 /etc/yum.repos.d/ Centos7的主要内容,如果未能解决你的问题,请参考以下文章

centos7 配置阿里镜像

CentOS7设置阿里镜像教程

Linux环境更换阿里镜像源提示Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/redhat.repo

Linux环境更换阿里镜像源提示Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/redhat.repo

centos 6.5 配置阿里云yum镜像

YUM源使用阿里镜像