一、源列表
aliyun源
#各系统版本repo文件对应的下载操作CentOS 5wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repoCentOS 6wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repoCentOS 7wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
163源
#各系统版本repo文件对应的下载操作CentOS 5wget -O /etc/yum.repos.d/CentOS5-Base-163.repo http://mirrors.163.com/.help/CentOS5-Base-163.repoCentOS 6wget -O /etc/yum.repos.d/CentOS6-Base-163.repo http://mirrors.163.com/.help/CentOS6-Base-163.repoCentOS 7wget -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-releaseCentOS 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, langpacksRepository base is listed more than once in the configurationRepository updates is listed more than once in the configurationRepository extras is listed more than once in the configurationRepository centosplus is listed more than once in the configurationRepodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast正在清理软件源: base epel extras mysql-connectors-community mysql-tools-community mysql56-community updatesCleaning up everything
Step 2 : 构建新的源缓存:(只展示一部分)
[lz@mail lcap-0.0.3]$ yum makecache已加载插件:fastestmirror, langpacksRepository base is listed more than once in the configurationRepository updates is listed more than once in the configurationRepository extras is listed more than once in the configurationRepository centosplus is listed more than once in the configurationRepodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fastbase | 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.comepel 12618/12618epel 12618/12618epel 12618/12618元数据缓存已建立
之后再使用yum安装软件,速度就可以起飞了。