Linux配置网络yum源,提高下载速度

1、centos默认的网络源为官方源,官方源为国外的站点,下载与更新速度有点慢,这时将网络源设置为国内的就会比较完美了,国内的开源镜像站点主要有:阿里云、网易、清华大学。在这里我将以阿里云、网易的进行演示。先备份 CentOS-Base.repo,以后可随时恢复。下载新的CentOS-Base.repo 到 /etc/yum.repos.d/ 目录下。

# 阿里的 ,根据自己的版本选择下载
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
 
# 网易的,根据自己的版本选择下载
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS5-Base-163.repo
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

2、重新生成yum缓存,首先清除系统yum缓存,然后重新生成新的yum缓存

[root@localhost ~]# yum clean all     
[root@localhost ~]# yum makecache
原文地址:https://www.cnblogs.com/Neonuu/p/13578640.html