Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast

weixin_34127717發表於2017-11-15

1、事件描述:CentOS7下使用tree命令,發現該命令沒有被安裝,在安裝的過程中發現yum報錯

1
2
3
4
5
[root@openstack-01 ~]# tree -d
bash: tree: 未找到命令...
[root@openstack-01 ~]# yum -y install tree
已載入外掛:fastestmirror, langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast

2、處理過程

a、直接執行yum makecache fast

[root@openstack-01 ~]# yum makecache fast

已載入外掛:fastestmirror, langpacks

Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast

備註:根據它的提示資訊執行操作,發現提示資訊依舊


b、清除yum快取

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[root@openstack-01 ~]# yum clean all
已載入外掛:fastestmirror, langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
正在清理軟體源: base centos-ceph-hammer centos-openstack-mitaka centos-qemu-ev extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
[5]-  已殺死               yum update
[root@openstack-01 ~]# yum makecache
已載入外掛:fastestmirror, langpacks
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的錯誤"
 One of the configured repositories failed (未知),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:
     1. Contact the upstream for the repository and get them to fix the problem.
     2. Reconfigure the baseurl/etcfor the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).
     3. Disable the repository, so yum won't use it by default. Yum will then
        just ignore the repository until you permanently enable it again or use
        --enablerepo for temporary usage:
            yum-config-manager --disable <repoid>
     4. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:
            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64

這時候我開始懷疑是不是我的yum所在的網路也存在問題


c、檢測網路連通性狀態,發現的確是網路存在問題

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
檢查了網路卡配置,發現DNS配置存在一些問題,手動修改並重置網路卡資訊,網路恢復正常
[root@openstack-01 ~]# yum clean all
已載入外掛:fastestmirror, langpacks
正在清理軟體源: base centos-ceph-hammer centos-openstack-mitaka centos-qemu-ev extras updates
Cleaning up everything
[root@openstack-01 ~]# yum -y install tree
已載入外掛:fastestmirror, langpacks
base                                                                                                                         | 3.6 kB  00:00:00     
centos-ceph-hammer                                                                                                           | 2.9 kB  00:00:00     
centos-openstack-mitaka                                                                                                      | 2.9 kB  00:00:00     
centos-qemu-ev                                                                                                               | 2.9 kB  00:00:00     
extras                                                                                                                       | 3.4 kB  00:00:00     
updates                                                                                                                      | 3.4 kB  00:00:00     
(1/7): centos-ceph-hammer/7/x86_64/primary_db                                                                                |  30 kB  00:00:01     
(2/7): extras/7/x86_64/primary_db                                                                                            | 132 kB  00:00:00     
(3/7): updates/7/x86_64/primary_db                                                                                           | 4.9 MB  00:00:01     
(4/7): centos-openstack-mitaka/x86_64/primary_db                                                                             | 452 kB  00:00:04     
(5/7): base/7/x86_64/primary_db                                                                                              | 5.3 MB  00:00:07     
(6/7): base/7/x86_64/group_gz                                                                                                | 155 kB  00:00:15     
(7/7): centos-qemu-ev/7/x86_64/primary_db                                                                                    |  23 kB  00:00:16     
Determining fastest mirrors
 * base: mirrors.zju.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
正在解決依賴關係
--> 正在檢查事務
---> 軟體包 tree.x86_64.0.1.6.0-10.el7 將被 安裝
--> 解決依賴關係完成
依賴關係解決
====================================================================================================================================================
 Package                         架構                              版本                                       源                               大小
====================================================================================================================================================
正在安裝:
 tree                            x86_64                            1.6.0-10.el7                               base                             46 k
事務概要
====================================================================================================================================================
安裝  1 軟體包
總下載量:46 k
安裝大小:87 k
Downloading packages:
tree-1.6.0-10.el7.x86_64.rpm                                                                                                 |  46 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安裝    : tree-1.6.0-10.el7.x86_64                                                                                                        1/1 
  驗證中      : tree-1.6.0-10.el7.x86_64                                                                                                        1/1 
已安裝:
  tree.x86_64 0:1.6.0-10.el7                                                                                                                        
完畢!
[root@openstack-01 ~]# tree
.
├── anaconda-ks.cfg
├── keystonerc_admin
├── keystonerc_demo
├── packstack-answers-20160505-132946.txt
├── packstack-answers-20160505-134047.txt
├── packstack-answers-20160505-152256.txt
├── \345\205\254\345\205\261
├── \346\250\241\346\235\277
├── \350\247\206\351\242\221
├── \345\233\276\347\211\207
├── \346\226\207\346\241\243
├── \344\270\213\350\275\275
├── \351\237\263\344\271\220
└── \346\241\214\351\235\242
    ├── \346\234\252\345\221\275\345\220\215\346\226\207\344\273\266\345\244\271
    └── \346\234\252\345\221\275\345\220\215\346\226\207\344\273\266\345\244\271\ 2
10 directories, 6 files

3、小結

在分析報錯資訊的時候,不能片面的根據提示資訊去做,要抓住核心,才能速度解決問題。










本文轉自 冰凍vs西瓜 51CTO部落格,原文連結:http://blog.51cto.com/molewan/1785975,如需轉載請自行聯絡原作者

相關文章