巧妹儿,点滴生活,生活点滴,都需要你来陪伴,往后余生,请多多指教。男人最幸福的事情是:一个好妻子,一份好工作,一个好身体。

2009-2022
DFHL
未分类

linux 修改yum 为阿里云源

为了加快yum的下载速度,我们可以讲yum源指向阿里云的资源。

操作方法:

1.备份系统的yum源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2.下载阿里的源

 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3. 运行yum makecache生成缓存

4.vi /etc/yum.repos.d/CentOS-Base.repo 查看更改。



另一种方法:

vi /etc/yum.repos.d/CentOS-Base.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/


文章如无特别注明均为原创! 作者: 等风也等你, 转载或复制请以 超链接形式 并注明出处 走近风的BLOG
原文地址《 linux 修改yum 为阿里云源》发布于2020年7月18日

分享到:
打赏

评论

游客

看不清楚?点图切换