Linux YUM: if your cache is too old
In RHEL, if your YUM cache has not been update over 2 weeks, then you will see the warning below:
1 2 3 |
[root@adamhuanlinux ~]# yum list | grep thunderbird Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast [root@adamhuanlinux ~]# |
Solution:
You can solve this error by “yum makecache” or “yum makecache fast”.
Perhaps, you may met this error:
1 2 3 4 5 6 7 |
[root@adamhuanlinux ~]# yum makecache fast Loaded plugins: langpacks, product-id, subscription-manager Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/os/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: cdn.redhat.com; Name or service not known" Trying other mirror. Metadata Cache Created [root@adamhuanlinux ~]# |
Because, DNS could not resolve redhat.com
More details:
1 2 3 4 5 6 |
[root@adamhuanlinux ~]# nslookup > server Default server: 114.114.114.114 Address: 114.114.114.114#53 > exit [root@adamhuanlinux ~]# |
You can change your DNS from “114.114.114.114” to “8.8.8.8”:
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 |
[root@adamhuanlinux ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp2s0 TYPE=Ethernet BOOTPROTO=static DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no NAME=enp2s0 UUID=284ada66-41a2-430d-ba6c-8761f0c6c1f0 DEVICE=enp2s0 ONBOOT=yes IPADDR=168.0.1.190 NETMASK=255.255.255.0 GATEWAY=168.0.1.37 DNS1=14.114.114.114 DNS2=8.8.8.8 HOSTNAME=adamhuanlinux [root@adamhuanlinux ~]# [root@adamhuanlinux ~]# service network restart Restarting network (via systemctl): [ OK ] [root@adamhuanlinux ~]# |
And “makecache” agian:
1 2 3 4 5 6 7 8 |
[root@adamhuanlinux ~]# yum makecache fast Loaded plugins: langpacks, product-id, subscription-manager Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast rhel-7-server-rpms | 3.7 kB 00:00 rhel-7-server-rpms/7Server/x86_64/primary_db | 12 MB 03:10 rhel-7-server-rpms/7Server/x86_64/updateinfo | 529 kB 00:29 Metadata Cache Created [root@adamhuanlinux ~]# |
————
Done.
本文所示的警告可以让你察觉到:在YUM中,repodata的存在感。