- yum install wget -y
rm -rf /etc/yum.repos.d/*
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
OR
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
修改name和baseurl中的” $releasever”关键字,全换成7。
删掉里面的http://mirrors.aliyuncs.com/centos/7/os/$basearch/ yum源地址。
- yum clean all
- yum makecache
或者更换以下代码:
- # 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=CentOS7 - Base - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
- http://mirrors.cloud.aliyuncs.com/centos/7/os/$basearch/
- gpgcheck=
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
- #released updates
- [updates]
- name=CentOS7 - Updates - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/
- http://mirrors.cloud.aliyuncs.com/centos/7/updates/$basearch/
- gpgcheck=
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
- #additional packages that may be useful
- [extras]
- name=CentOS7 - Extras - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/
- http://mirrors.cloud.aliyuncs.com/centos/7/extras/$basearch/
- gpgcheck=
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
- #additional packages that extend functionality of existing packages
- [centosplus]
- name=CentOS7 - Plus - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/
- http://mirrors.cloud.aliyuncs.com/centos/7/centosplus/$basearch/
- gpgcheck=
- enabled=
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
- #contrib - packages by Centos Users
- [contrib]
- name=CentOS7 - Contrib - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/7/contrib/$basearch/
- http://mirrors.cloud.aliyuncs.com/centos/7/contrib/$basearch/
- gpgcheck=
- enabled=
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
以上就是CentOS7快速更改yum源的详细内容,更多关于CentOS7快速更改yum源的资料请关注九品源码其它相关文章!