一、源列表
aliyun源
#各系统版本repo文件对应的下载操作 CentOS 5 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo CentOS 6 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo CentOS 7 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
163源
#各系统版本repo文件对应的下载操作 CentOS 5 wget -O /etc/yum.repos.d/CentOS5-Base-163.repo http://mirrors.163.com/.help/CentOS5-Base-163.repo CentOS 6 wget -O /etc/yum.repos.d/CentOS6-Base-163.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo CentOS 7 wget -O /etc/yum.repos.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
二、配置源
我用的是CentOS 7,以163源为例,操作如下:
[lz@mail lcap-0.0.3]$ cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) [lz@mail lcap-0.0.3]$ sudo wget -O /etc/yum.repos.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo [sudo] password for lz: --2018-07-23 14:11:05-- http://mirrors.163.com/.help/CentOS7-Base-163.repo 正在解析主机 mirrors.163.com (mirrors.163.com)... 59.111.0.251 正在连接 mirrors.163.com (mirrors.163.com)|59.111.0.251|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:1572 (1.5K) [application/octet-stream] 正在保存至: “/etc/yum.repos.d/CentOS7-Base-163.repo” 100%[=========================================================================================================================================================================>] 1,572 --.-K/s 用时 0s 2018-07-23 14:11:05 (89.9 MB/s) - 已保存 “/etc/yum.repos.d/CentOS7-Base-163.repo” [1572/1572])
三、源缓存
Step 1 : 清除旧的源缓存:
[lz@mail lcap-0.0.3]$ yum clean all 已加载插件:fastestmirror, langpacks Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast 正在清理软件源: base epel extras mysql-connectors-community mysql-tools-community mysql56-community updates Cleaning up everything
Step 2 : 构建新的源缓存:(只展示一部分)
[lz@mail lcap-0.0.3]$ yum makecache 已加载插件:fastestmirror, langpacks Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast base | 3.6 kB 00:00:00 epel/x86_64/metalink | 5.2 kB 00:00:00 epel | 3.2 kB 00:00:00 extras | 3.4 kB 00:00:00 mysql-connectors-community | 2.5 kB 00:00:00 mysql-tools-community | 2.5 kB 00:00:00 mysql56-community | 2.5 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/27): base/7/x86_64/group_gz | 166 kB 00:00:00 (2/27): epel/x86_64/group_gz | 88 kB 00:00:00 (3/27): epel/x86_64/updateinfo ... (26/27): updates/7/x86_64/filelists_db | 2.3 MB 00:00:04 (27/27): updates/7/x86_64/primary_db | 4.2 MB 00:00:04 Determining fastest mirrors * base: mirrors.163.com * epel: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.163.com * updates: mirrors.163.com epel 12618/12618 epel 12618/12618 epel 12618/12618 元数据缓存已建立
之后再使用yum安装软件,速度就可以起飞了。