java中的接口是类吗
416
2022-11-05
Linux之错误解决Error: Failed to download metadata for repo 'appstream': Cannot prepare intern
[root@echohye ~]# docker pull centosUsing default tag: latestlatest: Pulling from library/centosa1d0c7532777: Pull completeDigest: sha256:a27fd8080b517143cbbbab9dfb7c8571c40d67d534bbdee55bd6c473f432b177Status: Downloaded newer image for centos:latestdocker.io/library/centos:latest
一次学习时,在docker里用下面命令直接下载最新的centos时
[root@70a649ed185e home]# cat /etc/redhat-releaseCentOS Linux release 8.4.2105
需要下载vim时,弹出下面错误
[root@70a649ed185e home]# yum install vimFailed to set locale, defaulting to C.UTF-8CentOS Linux 8 - AppStream 5.4 B/s | 38 B 00:07Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
问题分析:
第一种可能的情况便是网络连接问题
检查是否可以连接外部网络,可以使用 ping baidu.com 查看是否有丢包情况。
如果丢包,则进一步检查网络连接是否正常;如果没有丢包,继续阅读下文
[root@70a649ed185e home]# ping baidu.comPING baidu.com (110.242.68.66) 56(84) bytes of data.64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=1 ttl=48 time=64.4 ms64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=2 ttl=48 time=69.1 ms64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=3 ttl=48 time=186 ms64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=4 ttl=48 time=119 ms64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=5 ttl=48 time=117 ms64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=6 ttl=48 time=143 ms^C--- baidu.com ping statistics ---6 packets transmitted, 6 received, 0% packet loss, time 8036msrtt min/avg/max/mdev = 64.381/125.352/186.111/42.685 ms
那么第二种情况,便是 CentOS 已经停止维护的问题。2020 年 12 月 8 号,CentOS 官方宣布了停止维护 CentOS Linux 的计划,并推出了 CentOS Stream 项目,CentOS Linux 8 作为 RHEL 8 的复刻版本,生命周期缩短,于 2021 年 12 月 31 日停止更新并停止维护(EOL),更多的信息可以查看 CentOS 官方公告。如果需要更新 CentOS,需要将镜像从 mirror.centos.org 更改为 vault.centos.org
解决方法 1.进入到 yum 的 repos 目录
cd /etc/yum.repos.d/
2.修改 centos 文件内容
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*sed -i 's|#baseurl=/etc/yum.repos.d/CentOS-*
3.生成缓存更新(第一次更新,速度稍微有点慢,耐心等待两分钟左右)
yum makecache
4.运行 yum update 并重新安装 vim
yum update -yyum -y install vim
操作过程及结果如下:
[root@70a649ed185e home]# cd /etc/yum.repos.d/[root@70a649ed185e yum.repos.d]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*[root@70a649ed185e yum.repos.d]# sed -i 's|#baseurl=/etc/yum.repos.d/CentOS-*[root@70a649ed185e yum.repos.d]# yum makecacheFailed to set locale, defaulting to C.UTF-8^CCentOS Linux 8 - AppStream 322 kB/s | 2.6 MB 00:08 Error: Failed to download metadata for repo 'appstream': Librepo was interrupted by a signal[root@70a649ed185e yum.repos.d]# yum makecacheFailed to set locale, defaulting to C.UTF-8CentOS Linux 8 - AppStream 633 kB/s | 8.4 MB 00:13CentOS Linux 8 - BaseOS 864 kB/s | 4.6 MB 00:05CentOS Linux 8 - Extras 1.4 kB/s | 10 kB 00:07Metadata cache created.[root@70a649ed185e yum.repos.d]# yum update -yFailed to set locale, defaulting to C.UTF-8Last metadata expiration check: 0:00:50 ago on Fri Aug 12 15:34:23 2022.Dependencies resolved.=============================================================================== Package Arch Version Repo Size===============================================================================Upgrading: bash x86_64 4.4.20-2.el8 baseos 1.5 M bind-export-libs x86_64 32:9.11.26-6.el8 baseos 1.1 M binutils x86_64 2.30-108.el8_5.1 baseos 5.8 M ca-certificates noarch 2021.2.50-80.0.el8_4 baseos 390 k centos-gpg-keys noarch 1:8-3.el8 baseos 12 k centos-linux-release noarch 8.5-1.2111.el8 baseos 22 k ... rpm-plugin-systemd-inhibit x86_64 4.14.3-19.el8 baseos 78 k shared-mime-info x86_64 1.9-3.el8 baseos 329 k trousers x86_64 0.3.15-1.el8 baseos 152 kTransaction Summary===============================================================================Install 35 PackagesUpgrade 104 PackagesTotal download size: 77 MDownloading Packages:(1/139): python3-unbound-1.7.3-17.el8.x86_64.r 118 kB/s | 119 kB 00:01(2/139): unbound-libs-1.7.3-17.el8.x86_64.rpm 350 kB/s | 503 kB 00:01(3/139): libxkbcommon-0.9.1-1.el8.x86_64.rpm 78 kB/s | 116 kB 00:01(4/139): crypto-policies-scripts-20210617-1.gi 270 kB/s | 83 kB 00:00(5/139): diffutils-3.6-6.el8.x86_64.rpm 1.1 MB/s | 358 kB 00:00(6/139): elfutils-debuginfod-client-0.185-1.el 273 kB/s | 66 kB 00:00...(137/139): yum-4.7.0-4.el8.noarch.rpm 404 kB/s | 205 kB 00:00(138/139): util-linux-2.32.1-28.el8.x86_64.rpm 1.4 MB/s | 2.5 MB 00:01(139/139): python3-libs-3.6.8-41.el8.x86_64.rp 1.0 MB/s | 7.8 MB 00:07-------------------------------------------------------------------------------Total 2.6 MB/s | 77 MB 00:29warning: /var/cache/dnf/appstream-d7987f026ef99c82/packages/libxkbcommon-0.9.1-1.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEYCentOS Linux 8 - AppStream 1.6 MB/s | 1.6 kB 00:00Importing GPG key 0x8483C65D: Userid : "CentOS (CentOS Official Signing Key)
Linux之错误解决Failed to set locale, defaulting to C.UTF-8
箴言:因为这些东西是非常简单的。不要抱怨自己学不会,那是因为你没有足够用心。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~