优化yum下载安装慢,不断换mirror
发布时间:2020-12-15 23:10:40 所属栏目:安全 来源:网络整理
导读:不停地换mirror,为了解决这个问题,在网上搜了好多资料,总结出一个基于aliyun的mirror源 先检查:是否能正常上网,DNS是否正常,网关gw是否正常,若通过ping 不正常,则解决好网络,再进行下面操作. ? 1. 清除缓存 [[email?protected] ~]# yum clean all已加载插件
不停地换mirror,为了解决这个问题,在网上搜了好多资料,总结出一个基于aliyun的mirror源 先检查:是否能正常上网,DNS是否正常,网关gw是否正常,若通过ping 不正常,则解决好网络,再进行下面操作. ? 1. 清除缓存 [[email?protected] ~]# yum clean all 已加载插件:fastestmirror 正在清理软件源: base extras updates Cleaning up everything Maybe you want: rm -rf /var/cache/yum,to also free up space taken by orphaned data from disabled or removed repos Cleaning up list of fastest mirrors 2.元数据建立 [[email?protected] ~]# yum makecache 已加载插件:fastestmirror Determining fastest mirrors * base: mirrors.cn99.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/12): base/7/x86_64/group_gz | 166 kB 00:00:01 (2/12): extras/7/x86_64/prestodelta | 100 kB 00:00:00 (3/12): extras/7/x86_64/filelists_db | 603 kB 00:00:02 (4/12): extras/7/x86_64/other_db | 126 kB 00:00:00 (5/12): extras/7/x86_64/primary_db | 205 kB 00:00:01 (6/12): base/7/x86_64/filelists_db | 6.9 MB 00:00:02 (7/12): base/7/x86_64/primary_db | 5.9 MB 00:00:03 (8/12): updates/7/x86_64/prestodelta | 679 kB 00:00:01 (9/12): updates/7/x86_64/other_db | 578 kB 00:00:01 (10/12): updates/7/x86_64/filelists_db | 3.4 MB 00:00:02 (11/12): updates/7/x86_64/primary_db | 6.0 MB 00:00:02 (12/12): base/7/x86_64/other_db | 2.5 MB 00:00:06 元数据缓存已建立 3. 更新 [[email?protected] ~]# yum update 已加载插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.cn99.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com No packages marked for update 4.备份yum源 [[email?protected] ~]# cd /etc/yum.repos.d/ [[email?protected] yum.repos.d]# ls CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo [[email?protected] yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.backup [[email?protected] yum.repos.d]# ls CentOS-Base.repo.backup CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo 5.?下载新的CentOS-Base.repo 到/etc/yum.repos.d/? 再创建缓存 [[email?protected] yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo --2018-12-02 17:55:13-- http://mirrors.aliyun.com/repo/Centos-7.repo 正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 183.61.14.235,183.61.14.231,183.61.14.236,... 正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|183.61.14.235|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:2523 (2.5K) [application/octet-stream] 正在保存至: “/etc/yum.repos.d/CentOS-Base.repo” 100%[===========================================================>] 2,523 --.-K/s 用时 0s 2018-12-02 17:55:18 (107 MB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2523/2523]) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |